{"id":1233,"date":"2020-05-06T00:00:00","date_gmt":"2020-05-05T15:00:00","guid":{"rendered":"https:\/\/www.ishikawasekkei.com\/?p=1233"},"modified":"2020-05-06T00:01:33","modified_gmt":"2020-05-05T15:01:33","slug":"python-programing-test-first","status":"publish","type":"post","link":"https:\/\/www.ishikawasekkei.com\/index.php\/2020\/05\/06\/python-programing-test-first\/","title":{"rendered":"Python\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0 \u61a7\u308c\u306e\u30c6\u30b9\u30c8\u30d5\u30a1\u30fc\u30b9\u30c8"},"content":{"rendered":"\n<p>\u3000\u4eca\u65e5\u3082\u898b\u306b\u6765\u3066\u304f\u3060\u3055\u3063\u3066\u3001\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u3002\u77f3\u5ddd\u3055\u3093\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u30c6\u30b9\u30c8\u30d5\u30a1\u30fc\u30b9\u30c8\u306e\u30b3\u30f3\u30bb\u30d7\u30c8\u3092\u521d\u3081\u3066\u805e\u3044\u305f\u3068\u304d\u3001\u3081\u3063\u3061\u3083\u30b9\u30c6\u30ad\u306a\u30a2\u30a4\u30c7\u30a3\u30a2\u3084\u3093\u3001\u5b9f\u73fe\u3067\u304d\u305f\u3089\u3069\u308c\u3060\u3051\u3057\u3042\u308f\u305b\u306a\u3072\u3068\u304c\u5897\u3048\u308b\u3053\u3068\u3067\u3057\u3087\u3046\u3001\u3068\u3001\u601d\u3063\u3066\u3044\u305f\u306e\u3092\u601d\u3044\u51fa\u3057\u307e\u3057\u305f\u3002\u4f55\u5ea6\u304b\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u7d4c\u9a13\u3057\u3066\u3001\u3059\u3063\u304b\u308a\u5fd8\u308c\u53bb\u3063\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3000\u57fa\u672c\u7684\u306a\u8003\u3048\u65b9\u306f\u7c21\u5358\u3067\u3001<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u30c6\u30b9\u30c8\u7528\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u8ffd\u52a0<\/li><li>\u3059\u3079\u3066\u306e\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3057\u3066\u3001\u8ffd\u52a0\u3057\u305f\u30c6\u30b9\u30c8\u306e\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3059\u308b\u306e\u3092\u78ba\u8a8d\u3059\u308b<\/li><li>\u30c6\u30b9\u30c8\u5bfe\u8c61\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4fee\u6b63\u3059\u308b<\/li><li>\u3059\u3079\u3066\u306e\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3057\u3066\u3001\u8ffd\u52a0\u3057\u305f\u30c6\u30b9\u30c8\u304c\u6210\u529f\u3059\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b<\/li><li>\u30ea\u30d5\u30a1\u30af\u30bf\u30ea\u30f3\u30b0\u3057\u3066\u3001\u91cd\u8907\u3092\u6392\u9664\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u304d\u308c\u3044\u306b\u3059\u308b<\/li><\/ul>\n\n\n\n<p>\u3068\u3044\u3046\u4f5c\u696d\u3092\u7e70\u308a\u8fd4\u3057\u3066\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u80b2\u3066\u3066\u3044\u304f\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u65b9\u6cd5\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u30e1\u30ea\u30c3\u30c8\u304c\u3044\u304f\u3064\u304b\u3042\u3063\u3066\u3001<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u5b9f\u884c\u53ef\u80fd\u306a\u30c6\u30b9\u30c8\u304c\u6b8b\u308b\u305f\u3081\u3001\u5909\u66f4\u304c\u3042\u3063\u305f\u6642\u306b\u3082\u518d\u5ea6\u305d\u306e\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3059\u308b\u3053\u3068\u3067\u3001\u3053\u308c\u307e\u3067\u306e\u52d5\u4f5c\u4fdd\u8a3c\u304c\u3067\u304d\u308b\u3002<\/li><li>\u30c6\u30b9\u30c8\u3092\u5148\u306b\u8003\u3048\u308b\u3053\u3068\u3067\u3001\u5148\u306b\u4ed5\u69d8\u3092\u660e\u78ba\u306b\u3059\u308b\u5fc5\u8981\u304c\u3067\u3066\u304f\u308b\u3002<\/li><li>\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u30c6\u30b9\u30c8\u3092\u3084\u3063\u3066\u304f\u308c\u308b\u3002<\/li><li>\u30c6\u30b9\u30c8\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u898b\u308b\u3053\u3068\u3067\u3001\u4f5c\u6210\u3055\u308c\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u5229\u7528\u65b9\u6cd5\u304c\u308f\u304b\u308b\u3002<\/li><li>\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u300c\u52d5\u4f5c\u3055\u305b\u308b\u305f\u3081\u306e\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u4f5c\u696d\u300d\u3068\u300c\u304d\u308c\u3044\u306b\u3059\u308b\u305f\u3081\u306e\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u4f5c\u696d\u300d\u306b\u5206\u96e2\u3067\u304d\u308b\u3002<\/li><\/ul>\n\n\n\n<p>\u3000\u30c6\u30b9\u30c8\u30d5\u30a1\u30fc\u30b9\u30c8\u3067\u3084\u3063\u3066\u3044\u308b\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3001\u3053\u308c\u307e\u3067\u898b\u305f\u3053\u3068\u304c\u306a\u304b\u3063\u305f\u306e\u3067\u3059\u3088\u306d\u3047\u3002\u73fe\u5728\u306f\u5897\u3048\u3066\u304d\u3066\u3044\u308b\u306e\u3067\u3057\u3087\u3046\u304b\u3002\u554f\u984c\u70b9\u306f\u3001\u65e2\u5b58\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u9014\u4e2d\u304b\u3089\u305d\u306e\u8003\u3048\u65b9\u3092\u6301\u3061\u8fbc\u3080\u3053\u3068\u304c\u3067\u304d\u306a\u3044\uff08\u3084\u308a\u306b\u304f\u3044\uff09\u3001\u3068\u3001\u8a00\u3063\u305f\u3068\u3053\u308d\u3067\u3057\u3087\u3046\u304b\u3002\u7d4c\u9a13\u304c\u306a\u3044\u306e\u306f\u3001\u81ea\u5206\u3067\u3084\u3063\u3066\u307f\u308b\u3057\u304b\u306a\u3044\u3067\u3057\u3087\u3046\u3001\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u307e\u305a\u306f\u5c0e\u5165\u90e8\u5206\u3092\u3084\u3063\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Python\u3067\u306e\u30c6\u30b9\u30c8\u30d5\u30a1\u30fc\u30b9\u30c8<\/h2>\n\n\n\n<p>\u3000Python\u306e\u6a19\u6e96\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u4e2d\u306b\u3001\u30c6\u30b9\u30c8\u7528\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306eunittest\u304c\u3042\u308a\u307e\u3059\u3002\u6a19\u6e96\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b<a href=\"https:\/\/docs.python.org\/ja\/3\/library\/unittest.html\" class=\"aioseop-link\">\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af<\/a>\u306e\u8aac\u660e\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u3001\u8a73\u7d30\u306f\u3053\u3053\u3067\u5206\u304b\u308b\u3068\u601d\u3044\u307e\u3059\u3002\u4eca\u56de\u306f\u7c21\u5358\u306a\u5229\u7528\u65b9\u6cd5\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">unittest\u306e\u4f7f\u3044\u65b9<\/h2>\n\n\n\n<p>\u3000\u30c6\u30b9\u30c8\u7528\u30af\u30e9\u30b9\u306e\u4f5c\u6210\u306f\u3001unittest.TestCase\u3092\u7d99\u627f\u3057\u3066\u4f5c\u6210\u3057\u307e\u3059\u3002\u4f5c\u6210\u3057\u305f\u30c6\u30b9\u30c8\u30af\u30e9\u30b9\u306e\u4e2d\u306btest_\u3067\u59cb\u307e\u308b\u30e1\u30bd\u30c3\u30c9\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u3067\u30c6\u30b9\u30c8\u304c\u8ffd\u52a0\u3067\u304d\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u3053\u3093\u306a\u611f\u3058\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import unittest\n\nclass MyFirstTestCase(unittest.TestCase):\n    def test_my_first_test(self):\n        self.assertEqual(1, 1)\n\n    def test_my_second_test(self):\n        self.assertNotEqual(1, 2)\n\nif __name__ == \"__main__\":\n    unittest.main()<\/pre>\n\n\n\n<p>\u3000\u5b9f\u884c\u3059\u308b\u3068\u3053\u3093\u306a\u7d50\u679c\u304c\u51fa\u529b\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">..\n----------------------------------------------------------------------\nRan 2 tests in 0.005s\n\nOK<\/pre>\n\n\n\n<p>\u3000\u51fa\u529b\u7d50\u679c\u3067\u3059\u304c\u3001\u6700\u521d\u306e\u300c..\u300d\u306e\u70b9\u3072\u3068\u3064\u304c\u30c6\u30b9\u30c8\u30e1\u30bd\u30c3\u30c9\u4e00\u4ef6\u3092\u8868\u3057\u3066\u3044\u3066\u3001\u30c6\u30b9\u30c8\u304c\u5931\u6557\u3057\u305f\u3068\u304d\u306b\u300cE\u300d\u304c\u51fa\u529b\u3055\u308c\u307e\u3059\u3002\u5931\u6557\u3059\u308b\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u3092\u8ffd\u52a0\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">    def test_my_third_test(self):\n        self.assertFalse(True)<\/pre>\n\n\n\n<p>\u3000\u7d50\u679c\u306f\u3053\u3093\u306a\u611f\u3058\u306e\u51fa\u529b\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">..F\n======================================================================\nFAIL: test_my_third_test (__main__.MyFirstTestCase)\n----------------------------------------------------------------------\nTraceback (most recent call last):\n  File \"C:\/work\/tkinter_example\/unit_test_example.py\", line 18, in test_my_third_test\n    self.assertFalse(True)\nAssertionError: True is not false\n\n----------------------------------------------------------------------\nRan 3 tests in 0.005s\n\nFAILED (failures=1)<\/pre>\n\n\n\n<p>\u3000\u4e09\u3064\u76ee\u306b\u300cE\u300d\u304c\u51fa\u529b\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u3000\u5404\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3059\u308b\u524d\u306b\u5fc5\u305a\u5b9f\u884c\u3057\u305f\u3044\u51e6\u7406\u304c\u3042\u308b\u5834\u5408\u306f\u3001setUp()\u30e1\u30bd\u30c3\u30c9\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002\u5404\u30c6\u30b9\u30c8\u306e\u7d42\u4e86\u6642\u306b\u5fc5\u305a\u51e6\u7406\u3092\u5b9f\u884c\u3057\u305f\u3044\u5834\u5408\u306f\u3001tearDown()\u30e1\u30bd\u30c3\u30c9\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">    def setUp(self):\n        print('setUp executed!')\n\n    def tearDown(self):\n        print('tearDown executed!')<\/pre>\n\n\n\n<p>\u3000\u5b9f\u884c\u3059\u308b\u3068\u3053\u3093\u306a\u98a8\u306a\u51fa\u529b\u7d50\u679c\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">..FsetUp executed!\ntearDown executed!\nsetUp executed!\ntearDown executed!\nsetUp executed!\ntearDown executed!\n\n======================================================================\nFAIL: test_my_third_test (__main__.MyFirstTestCase)\n----------------------------------------------------------------------\nTraceback (most recent call last):\n  File \"C:\/work\/tkinter_example\/unit_test_example.py\", line 24, in test_my_third_test\n    self.assertFalse(True)\nAssertionError: True is not false\n\n----------------------------------------------------------------------\nRan 3 tests in 0.006s\n\nFAILED (failures=1)<\/pre>\n\n\n\n<p>\u3000\u3061\u3087\u3063\u3068\u300c..F\u300d\u306e\u3059\u3050\u5f8c\u308d\u306b\u300csetUp\u300d\u306e\u51fa\u529b\u7d50\u679c\u304c\u7d9a\u3044\u3066\u51fa\u3066\u3044\u308b\u306e\u304c\u6c17\u306b\u306a\u308a\u307e\u3059\u304c\u3001\u3061\u3083\u3093\u3068\u30c6\u30b9\u30c8\u3092\u5b9f\u884c\u3059\u308b\u524d\u5f8c\u306b\u5b9f\u884c\u3055\u308c\u3066\u3044\u308b\u3088\u3046\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3000\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u306e\u6700\u521d\u306b1\u56de\u3060\u3051\u3001\u6700\u5f8c\u306b1\u56de\u3060\u3051\u5b9f\u884c\u3059\u308b\u3088\u3046\u306a\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u305d\u308c\u305e\u308c\u3001setUpClass()\u3068tearDownClass()\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002\u305f\u3060\u3057\u3001\u30af\u30e9\u30b9\u30e1\u30bd\u30c3\u30c9\u3068\u3057\u3066\u8ffd\u52a0\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">    @classmethod\n    def setUpClass(cls):\n        print('setUpClass executed!')\n\n    @classmethod\n    def tearDownClass(cls):\n        print('tearDownClass executed!')<\/pre>\n\n\n\n<p>\u3000\u5b9f\u884c\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u51fa\u529b\u304c\u5909\u308f\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">..FsetUpClass executed!\nsetUp executed!\ntearDown executed!\nsetUp executed!\ntearDown executed!\nsetUp executed!\ntearDown executed!\ntearDownClass executed!<\/pre>\n\n\n\n<p>\u3068\u3001\u9577\u304f\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u304c\u3001\u304a\u304a\u3080\u306d\u3053\u306e\u3088\u3046\u306a\u611f\u3058\u3067\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u3092\u4f5c\u6210\u3057\u3066\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3000\u4eca\u65e5\u3082\u898b\u306b\u6765\u3066\u304f\u3060\u3055\u3063\u3066\u3001\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u3002\u77f3\u5ddd\u3055\u3093\u3067\u3059\u3002 \u3000\u30c6\u30b9\u30c8\u30d5\u30a1\u30fc\u30b9\u30c8\u306e\u30b3\u30f3\u30bb\u30d7\u30c8\u3092\u521d\u3081\u3066\u805e\u3044\u305f\u3068\u304d\u3001\u3081\u3063\u3061\u3083\u30b9\u30c6\u30ad\u306a\u30a2\u30a4\u30c7\u30a3\u30a2\u3084\u3093\u3001\u5b9f\u73fe\u3067\u304d\u305f\u3089\u3069\u308c\u3060\u3051\u3057\u3042\u308f\u305b\u306a\u3072\u3068\u304c\u5897\u3048\u308b\u3053\u3068\u3067\u3057\u3087\u3046\u3001\u3068\u3001\u601d\u3063\u3066\u3044\u305f\u306e &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.ishikawasekkei.com\/index.php\/2020\/05\/06\/python-programing-test-first\/\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Python\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0 \u61a7\u308c\u306e\u30c6\u30b9\u30c8\u30d5\u30a1\u30fc\u30b9\u30c8&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,2],"tags":[],"class_list":["post-1233","post","type-post","status-publish","format-standard","hentry","category-program","category-blog"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.ishikawasekkei.com\/index.php\/wp-json\/wp\/v2\/posts\/1233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ishikawasekkei.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ishikawasekkei.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ishikawasekkei.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ishikawasekkei.com\/index.php\/wp-json\/wp\/v2\/comments?post=1233"}],"version-history":[{"count":2,"href":"https:\/\/www.ishikawasekkei.com\/index.php\/wp-json\/wp\/v2\/posts\/1233\/revisions"}],"predecessor-version":[{"id":1235,"href":"https:\/\/www.ishikawasekkei.com\/index.php\/wp-json\/wp\/v2\/posts\/1233\/revisions\/1235"}],"wp:attachment":[{"href":"https:\/\/www.ishikawasekkei.com\/index.php\/wp-json\/wp\/v2\/media?parent=1233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ishikawasekkei.com\/index.php\/wp-json\/wp\/v2\/categories?post=1233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ishikawasekkei.com\/index.php\/wp-json\/wp\/v2\/tags?post=1233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}