æ°æ¥åããPython2.7ãåå¼·ãå§ãã¦ãã¾ãã WEBãã¥ã¼ããªã¢ã«ãå°ããã¤ãã£ã¦ãããã§ãããå å®åº¦ããããã ãããªè¨³ã§Pythonã«æ¨æºã§å ¥ã£ã¦ããunittestã使ãã assertRaisesã«ã¦ä¾å¤ã®ãã¹ããæ¸ããã¨ãã¾ããã (noseã¨ãpy.testã¨ãã®æ¹ã便å©ãããã§ããã ã¾ãã¯æ¨æºã®ç¶æ ã§ã¢ã¬ã³ã¬ãããã£ãã®ã§unittestã«ãã¦ã¾ã) ãããªãµãã«ã import unittest class MyException(Exception): pass class Target: def something(self): raise MyException class Test(unittest.TestCase): def setUp(self): self.target = Target() def test_exception(self): sel
{{#tags}}- {{label}}
{{/tags}}