{"url":"https://kwatch.hatenadiary.org/entry/20090628/1246167399","blog_url":"https://kwatch.hatenadiary.org/","blog_title":"k\u306a\u3093\u3068\u304b\u306e\u65e5\u8a18","author_name":"kwatch","provider_name":"Hatena Blog","published":"2009-06-28 14:36:39","version":"1.0","provider_url":"https://hatena.blog","title":" Python \u306e unittest \u3067\u306f assertRaises \u304c Exception \u3092\u8fd4\u3057\u3066\u304f\u308c\u306a\u3044","description":"\u3061\u306a\u307f\u306b Python \u4ed8\u5c5e\u306e unittest \u3067\u306f assertRaises \u306e\u5b9a\u7fa9\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3002\u898b\u308c\u3070\u308f\u304b\u308b\u3051\u3069\u3001exception \u3092\u8fd4\u3057\u3066\u304f\u308c\u306a\u3044\u3002 ## assertRails \u306f failUnlessRaises \u306e alias def failUnlessRaises(self, excClass, callableObj, *args, **kwargs): try: callableObj(*args, **kwargs) except excClass: ## \u3053\u3053\u3092 except excClass, ex: return ex return ## \u306b\u3057\u3066\u307b\u3057\u304b\u3063\u305f el\u2026","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fkwatch.hatenadiary.org%2Fentry%2F20090628%2F1246167399\" title=\" Python \u306e unittest \u3067\u306f assertRaises \u304c Exception \u3092\u8fd4\u3057\u3066\u304f\u308c\u306a\u3044 - k\u306a\u3093\u3068\u304b\u306e\u65e5\u8a18\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","height":"190","type":"rich","author_url":"https://blog.hatena.ne.jp/kwatch/","width":"100%","image_url":null,"categories":["python"]}