{"id":799,"date":"2022-11-08T07:51:22","date_gmt":"2022-10-19T11:41:01","guid":{"rendered":"https:\/\/www.silicloud.com\/ja\/blog\/index.php\/2023\/11\/30\/python%e3%81%aeunittest%e3%81%a7%e3%81%ae%e3%83%a6%e3%83%8b%e3%83%83%e3%83%88%e3%83%86%e3%82%b9%e3%83%88%e3%81%ae%e4%be%8b\/"},"modified":"2025-08-01T02:34:14","modified_gmt":"2025-07-31T17:34:14","slug":"python%e3%81%aeunittest%e3%81%a7%e3%81%ae%e3%83%a6%e3%83%8b%e3%83%83%e3%83%88%e3%83%86%e3%82%b9%e3%83%88%e3%81%ae%e4%be%8b","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aeunittest%e3%81%a7%e3%81%ae%e3%83%a6%e3%83%8b%e3%83%83%e3%83%88%e3%83%86%e3%82%b9%e3%83%88%e3%81%ae%e4%be%8b\/","title":{"rendered":"Python\u306eunittest\u3067\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u4f8b"},"content":{"rendered":"<p>\u4eca\u65e5\u306f\u3001Python\u306eunittest\u306b\u3064\u3044\u3066\u5b66\u3073\u3001Python\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u5b9f\u4f8b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002\u524d\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001Python\u306ezip\u95a2\u6570\u306b\u3064\u3044\u3066\u5b66\u3073\u307e\u3057\u305f\u3002<\/p>\n<h2>Python\u306eunittest<\/h2>\n<p>Python\u306eunittest\u30e2\u30b8\u30e5\u30fc\u30eb\u306f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306e\u5358\u4f4d\u3092\u30c6\u30b9\u30c8\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u30c6\u30b9\u30c8\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3068\u3057\u307e\u3059\u3002\u95a2\u6570\u304c\u3069\u306e\u3088\u3046\u306a\u30c7\u30fc\u30bf\u3092\u8fd4\u3059\u304b\u306f\u308f\u304b\u3063\u3066\u3044\u307e\u3059\u3002\u5927\u91cf\u306e\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u305f\u5f8c\u3001\u51fa\u529b\u304c\u6b63\u3057\u3044\u304b\u3069\u3046\u304b\u3092\u78ba\u8a8d\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u901a\u5e38\u3001\u79c1\u305f\u3061\u304c\u3059\u308b\u306e\u306f\u51fa\u529b\u3092\u8868\u793a\u3057\u3001\u53c2\u7167\u306e\u51fa\u529b\u30d5\u30a1\u30a4\u30eb\u3068\u4e00\u81f4\u3055\u305b\u308b\u304b\u3001\u51fa\u529b\u3092\u624b\u52d5\u3067\u78ba\u8a8d\u3059\u308b\u3053\u3068\u3067\u3059\u3002\u3053\u306e\u624b\u9593\u3092\u7701\u304f\u305f\u3081\u306b\u3001Python\u3067\u306funittest\u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u5c0e\u5165\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u7c21\u5358\u306a\u30b3\u30fc\u30c9\u3067\u95a2\u6570\u306e\u51fa\u529b\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001Python\u306eunittest\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9\u3068\u30af\u30e9\u30b9\u306e\u95a2\u6570\u3092\u30c6\u30b9\u30c8\u3059\u308b\u305f\u3081\u306e\u3044\u304f\u3064\u304b\u306ePython\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<h3>Python\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u4f8b\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3002<\/h3>\n<p>\u307e\u305a\u6700\u521d\u306b\u3001\u305d\u308c\u3089\u3092\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u3059\u308b\u305f\u3081\u306e\u3044\u304f\u3064\u304b\u306e\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002Python\u306e\u30af\u30e9\u30b9\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u30af\u30e9\u30b9\u306e\u4e3b\u306a\u76ee\u7684\u306f\u3001\u4eba\u7269\u306e\u540d\u524d\u3092\u4fdd\u5b58\u304a\u3088\u3073\u53d6\u5f97\u3059\u308b\u3053\u3068\u3067\u3059\u3002\u3057\u305f\u304c\u3063\u3066\u3001\u30c7\u30fc\u30bf\u3092\u4fdd\u5b58\u3059\u308b\u305f\u3081\u306eset_name()\u95a2\u6570\u3068\u3001\u30af\u30e9\u30b9\u304b\u3089\u540d\u524d\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081\u306eget_name()\u95a2\u6570\u3092\u66f8\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>class Person:\r\n    name = []\r\n\r\n    def set_name(self, user_name):\r\n        self.name.append(user_name)\r\n        return len(self.name) - 1\r\n\r\n    def get_name(self, user_id):\r\n        if user_id &gt;= len(self.name):\r\n            return 'There is no such user'\r\n        else:\r\n            return self.name[user_id]\r\n\r\n\r\nif __name__ == '__main__':\r\n    person = Person()\r\n    print('User Abbas has been added with id ', person.set_name('Abbas'))\r\n    print('User associated with id 0 is ', person.get_name(0))\r\n<\/code><\/pre>\n<p>\u79c1\u305f\u3061\u306f\u30af\u30e9\u30b9\u30d5\u30a1\u30a4\u30eb\u3092Person.py\u3068\u540d\u4ed8\u3051\u307e\u3057\u305f\u3002\u307e\u305f\u3001\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u306e\u51fa\u529b\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>$ python3.6 Person.py \r\nUser Abbas has been added with id  0\r\nUser associated with id 0 is  Abbas\r\n$\r\n<\/code><\/pre>\n<h3>Python\u306eunittest\u306e\u69cb\u9020<\/h3>\n<p>\u3055\u3042\u3001\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u305f\u3081\u306e\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u65b9\u6cd5\u3092\u5b66\u3073\u307e\u3057\u3087\u3046\u3002\u5358\u4f53\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u306f\u3001unittest.TestCase\u3092\u30b5\u30d6\u30af\u30e9\u30b9\u5316\u3059\u308b\u3053\u3068\u3067\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002\u9069\u5207\u306a\u95a2\u6570\u3092\u4e0a\u66f8\u304d\u307e\u305f\u306f\u8ffd\u52a0\u3059\u308b\u3053\u3068\u3067\u3001\u30c6\u30b9\u30c8\u306e\u305f\u3081\u306e\u30ed\u30b8\u30c3\u30af\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u6b21\u306e\u30b3\u30fc\u30c9\u306f\u3001a\u304cb\u3068\u7b49\u3057\u3044\u5834\u5408\u306b\u6210\u529f\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>import unittest\r\n\r\n\r\nclass Testing(unittest.TestCase):\r\n    def test_string(self):\r\n        a = 'some'\r\n        b = 'some'\r\n        self.assertEqual(a, b)\r\n\r\n    def test_boolean(self):\r\n        a = True\r\n        b = True\r\n        self.assertEqual(a, b)\r\n\r\nif __name__ == '__main__':\r\n    unittest.main()\r\n\r\n<\/code><\/pre>\n<h3>Python\u306eunittest\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u5b9f\u884c\u65b9\u6cd5\u306f\u3069\u3046\u3059\u308c\u3070\u3044\u3044\u3067\u3059\u304b\u3002<\/h3>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/6564a33bdaa94e2bdf7c30cb\/12-0.png\" alt=\"Python unittest, python unit test example\" \/><\/div>\n<h3>Python\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u7d50\u679c\u3068\u57fa\u672c\u7684\u306a\u6a5f\u80fd<\/h3>\n<p>\u3053\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306b\u306f3\u3064\u306e\u53ef\u80fd\u306a\u7d50\u679c\u304c\u3042\u308a\u307e\u3059\u3002\u4ee5\u4e0b\u306b\u305d\u308c\u3089\u3092\u793a\u3057\u307e\u3059\u3002<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>OK: \u3082\u3057\u5168\u3066\u306e\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u304c\u5408\u683c\u3057\u305f\u5834\u5408\u3001\u51fa\u529b\u306fOK\u3068\u8868\u793a\u3057\u307e\u3059\u3002<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>\n<li style=\"list-style-type: none;\">\n<ol>Failure: \u3082\u3057\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u306e\u3044\u305a\u308c\u304b\u304c\u5931\u6557\u3057AssertionError\u4f8b\u5916\u304c\u767a\u751f\u3057\u305f\u5834\u5408<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<ol>Error: \u3082\u3057AssertionError\u4f8b\u5916\u4ee5\u5916\u306e\u4f8b\u5916\u304c\u767a\u751f\u3057\u305f\u5834\u5408\u3002<\/ol>\n<p>unittest\u30e2\u30b8\u30e5\u30fc\u30eb\u306b\u306f\u3001\u3044\u304f\u3064\u304b\u306e\u95a2\u6570\u304c\u3042\u308a\u307e\u3059\u3002\u4e0b\u306b\u30ea\u30b9\u30c8\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<div>\n<div class=\"post-table\">\n<table>\n<thead>\n<tr>\n<th>Method<\/th>\n<th>Checks that<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>assertEqual(a,b)<\/td>\n<td>a==b<\/td>\n<\/tr>\n<tr>\n<td>assertNotEqual(a,b)<\/td>\n<td>a != b<\/td>\n<\/tr>\n<tr>\n<td>assertTrue(x)<\/td>\n<td>bool(x) is True<\/td>\n<\/tr>\n<tr>\n<td>assertFalse(x)<\/td>\n<td>bool(x) is False<\/td>\n<\/tr>\n<tr>\n<td>assertIs(a,b)<\/td>\n<td>a is b<\/td>\n<\/tr>\n<tr>\n<td>assertIs(a,b)<\/td>\n<td>a is b<\/td>\n<\/tr>\n<tr>\n<td>assertIsNot(a, b)<\/td>\n<td>a is not b<\/td>\n<\/tr>\n<tr>\n<td>assertIsNone(x)<\/td>\n<td>x is None<\/td>\n<\/tr>\n<tr>\n<td>assertIsNotNone(x)<\/td>\n<td>x is not None<\/td>\n<\/tr>\n<tr>\n<td>assertIn(a, b)<\/td>\n<td>a in b<\/td>\n<\/tr>\n<tr>\n<td>assertNotIn(a, b)<\/td>\n<td>a not in b<\/td>\n<\/tr>\n<tr>\n<td>assertIsInstance(a, b)<\/td>\n<td>isinstance(a, b)<\/td>\n<\/tr>\n<tr>\n<td>assertNotIsInstance(a, b)<\/td>\n<td>not isinstance(a, b)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>Python\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u4f8b\u3092\u4e00\u3064\u6319\u3052\u3066\u304f\u3060\u3055\u3044\u3002<\/h3>\n<p>\u4eca\u3001\u79c1\u305f\u3061\u306e\u30bd\u30fc\u30b9\u30af\u30e9\u30b9\u300cPerson\u300d\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u3092\u66f8\u304f\u6642\u9593\u3067\u3059\u3002\u3053\u306e\u30af\u30e9\u30b9\u3067\u306f\u3001\u300cget_name()\u300d\u3068\u300cset_name()\u300d\u3068\u3044\u30462\u3064\u306e\u95a2\u6570\u3092\u5b9f\u88c5\u3057\u3066\u3044\u307e\u3059\u3002\u4eca\u56de\u306f\u3001unittest\u3092\u4f7f\u3063\u3066\u3053\u308c\u3089\u306e\u95a2\u6570\u3092\u30c6\u30b9\u30c8\u3057\u307e\u3059\u3002\u3057\u305f\u304c\u3063\u3066\u3001\u3053\u308c\u3089\u306e2\u3064\u306e\u95a2\u6570\u306e\u305f\u3081\u306b2\u3064\u306e\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u3092\u8a2d\u8a08\u3057\u307e\u3057\u305f\u3002\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u898b\u3066\u3044\u305f\u3060\u3051\u308c\u3070\u3001\u7c21\u5358\u306b\u7406\u89e3\u3067\u304d\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"post-pre\"><code>import unittest\r\n\r\n# This is the class we want to test. So, we need to import it\r\nimport Person as PersonClass\r\n\r\n\r\nclass Test(unittest.TestCase):\r\n    \"\"\"\r\n    The basic class that inherits unittest.TestCase\r\n    \"\"\"\r\n    person = PersonClass.Person()  # instantiate the Person Class\r\n    user_id = []  # variable that stores obtained user_id\r\n    user_name = []  # variable that stores person name\r\n\r\n    # test case function to check the Person.set_name function\r\n    def test_0_set_name(self):\r\n        print(\"Start set_name test\\n\")\r\n        \"\"\"\r\n        Any method which starts with ``test_`` will considered as a test case.\r\n        \"\"\"\r\n        for i in range(4):\r\n            # initialize a name\r\n            name = 'name' + str(i)\r\n            # store the name into the list variable\r\n            self.user_name.append(name)\r\n            # get the user id obtained from the function\r\n            user_id = self.person.set_name(name)\r\n            # check if the obtained user id is null or not\r\n            self.assertIsNotNone(user_id)  # null user id will fail the test\r\n            # store the user id to the list\r\n            self.user_id.append(user_id)\r\n        print(\"user_id length = \", len(self.user_id))\r\n        print(self.user_id)\r\n        print(\"user_name length = \", len(self.user_name))\r\n        print(self.user_name)\r\n        print(\"\\nFinish set_name test\\n\")\r\n\r\n    # test case function to check the Person.get_name function\r\n    def test_1_get_name(self):\r\n        print(\"\\nStart get_name test\\n\")\r\n        \"\"\"\r\n        Any method that starts with ``test_`` will be considered as a test case.\r\n        \"\"\"\r\n        length = len(self.user_id)  # total number of stored user information\r\n        print(\"user_id length = \", length)\r\n        print(\"user_name length = \", len(self.user_name))\r\n        for i in range(6):\r\n            # if i not exceed total length then verify the returned name\r\n            if i &lt; length:\r\n                # if the two name not matches it will fail the test case\r\n                self.assertEqual(self.user_name[i], self.person.get_name(self.user_id[i]))\r\n            else:\r\n                print(\"Testing for get_name no user test\")\r\n                # if length exceeds then check the 'no such user' type message\r\n                self.assertEqual('There is no such user', self.person.get_name(i))\r\n        print(\"\\nFinish get_name test\\n\")\r\n\r\n\r\nif __name__ == '__main__':\r\n    # begin the unittest.main()\r\n    unittest.main()\r\n<\/code><\/pre>\n<p>\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u95a2\u6570\u306e\u5b9f\u884c\u9806\u5e8f\u306f\u3001\u305d\u306e\u540d\u524d\u306e\u9806\u5e8f\u306b\u5f93\u3063\u3066\u3044\u307e\u3059\u3002\u3057\u305f\u304c\u3063\u3066\u3001set_name\u30c6\u30b9\u30c8\u3092\u6700\u521d\u306b\u5b9f\u884c\u3057\u305f\u3044\u5834\u5408\u3001\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u95a2\u6570\u3092test_0_set_name\u3068test_1_get_name\u3068\u3044\u3046\u540d\u524d\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<h3>Python\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u4f8b\u306e\u51fa\u529b<\/h3>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/6564a33bdaa94e2bdf7c30cb\/23-1.png\" alt=\"python unittest tutorial\" \/><\/div>\n<pre class=\"post-pre\"><code>$ python3.6 -m unittest -v PersonTest.Test\r\ntest_0_set_name (PersonTest.Test) ... Start set_name test\r\n\r\nuser_id length =  4\r\n[0, 1, 2, 3]\r\nuser_name length =  4\r\n['name0', 'name1', 'name2', 'name3']\r\n\r\nFinish set_name test\r\n\r\nok\r\ntest_1_get_name (PersonTest.Test) ... \r\nStart get_name test\r\n\r\nuser_id length =  4\r\nuser_name length =  4\r\nTesting for get_name no user test\r\nTesting for get_name no user test\r\n\r\nFinish get_name test\r\n\r\nok\r\n\r\n----------------------------------------------------------------------\r\nRan 2 tests in 0.000s\r\n\r\nOK\r\n$\r\n<\/code><\/pre>\n<p>\u3053\u308c\u306fPython\u306eunittest\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306b\u3064\u3044\u3066\u306e\u3059\u3079\u3066\u3067\u3059\u3002\u3082\u3063\u3068\u5b66\u3073\u305f\u3044\u5834\u5408\u306f\u3001\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3092\u8aad\u3093\u3067\u304f\u3060\u3055\u3044\u3002\u3055\u3089\u306a\u308b\u8cea\u554f\u306b\u306f\u30b3\u30e1\u30f3\u30c8\u30dc\u30c3\u30af\u30b9\u3092\u3054\u5229\u7528\u304f\u3060\u3055\u3044\u3002 \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u65e5\u306f\u3001Python\u306eunittest\u306b\u3064\u3044\u3066\u5b66\u3073\u3001Python\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u5b9f\u4f8b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002\u524d\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001Python\u306ezip\u95a2\u6570\u306b\u3064\u3044\u3066\u5b66\u3073\u307e\u3057\u305f\u3002 Python\u306eunittest P [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[31,26],"class_list":["post-799","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-python","tag-26"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python\u306eunittest\u3067\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u4f8b - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"Python\u306eunittest\u3067\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u4f8b\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/ja\/blog\/python\u306eunittest\u3067\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u4f8b\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python\u306eunittest\u3067\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u4f8b\" \/>\n<meta property=\"og:description\" content=\"Python\u306eunittest\u3067\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u4f8b\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/ja\/blog\/python\u306eunittest\u3067\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u4f8b\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2022-10-19T11:41:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-31T17:34:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/6564a33bdaa94e2bdf7c30cb\/12-0.png\" \/>\n<meta name=\"author\" content=\"\u512a\u6597, \u671d\u967d\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u512a\u6597, \u671d\u967d\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"12\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aeunittest%e3%81%a7%e3%81%ae%e3%83%a6%e3%83%8b%e3%83%83%e3%83%88%e3%83%86%e3%82%b9%e3%83%88%e3%81%ae%e4%be%8b\/\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aeunittest%e3%81%a7%e3%81%ae%e3%83%a6%e3%83%8b%e3%83%83%e3%83%88%e3%83%86%e3%82%b9%e3%83%88%e3%81%ae%e4%be%8b\/\",\"name\":\"Python\u306eunittest\u3067\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u4f8b - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\"},\"datePublished\":\"2022-10-19T11:41:01+00:00\",\"dateModified\":\"2025-07-31T17:34:14+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/cab7534c71201607a41f395de14d7d28\"},\"description\":\"Python\u306eunittest\u3067\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u4f8b\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aeunittest%e3%81%a7%e3%81%ae%e3%83%a6%e3%83%8b%e3%83%83%e3%83%88%e3%83%86%e3%82%b9%e3%83%88%e3%81%ae%e4%be%8b\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aeunittest%e3%81%a7%e3%81%ae%e3%83%a6%e3%83%8b%e3%83%83%e3%83%88%e3%83%86%e3%82%b9%e3%83%88%e3%81%ae%e4%be%8b\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aeunittest%e3%81%a7%e3%81%ae%e3%83%a6%e3%83%8b%e3%83%83%e3%83%88%e3%83%86%e3%82%b9%e3%83%88%e3%81%ae%e4%be%8b\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/ja\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\u306eunittest\u3067\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u4f8b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"ja\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/cab7534c71201607a41f395de14d7d28\",\"name\":\"\u512a\u6597, \u671d\u967d\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/56ecb1d20648a2ff67709eeaa7b6eddeb4d52aca0d46febc7f12bbef507187d0?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/56ecb1d20648a2ff67709eeaa7b6eddeb4d52aca0d46febc7f12bbef507187d0?s=96&d=mm&r=g\",\"caption\":\"\u512a\u6597, \u671d\u967d\"},\"url\":\"https:\/\/www.silicloud.com\/ja\/blog\/author\/yutoasahi\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aeunittest%e3%81%a7%e3%81%ae%e3%83%a6%e3%83%8b%e3%83%83%e3%83%88%e3%83%86%e3%82%b9%e3%83%88%e3%81%ae%e4%be%8b\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Python\u306eunittest\u3067\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u4f8b - Blog - Silicon Cloud","description":"Python\u306eunittest\u3067\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u4f8b\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/ja\/blog\/python\u306eunittest\u3067\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u4f8b\/","og_locale":"ja_JP","og_type":"article","og_title":"Python\u306eunittest\u3067\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u4f8b","og_description":"Python\u306eunittest\u3067\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u4f8b\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","og_url":"https:\/\/www.silicloud.com\/ja\/blog\/python\u306eunittest\u3067\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u4f8b\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2022-10-19T11:41:01+00:00","article_modified_time":"2025-07-31T17:34:14+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/6564a33bdaa94e2bdf7c30cb\/12-0.png"}],"author":"\u512a\u6597, \u671d\u967d","twitter_card":"summary_large_image","twitter_misc":{"\u57f7\u7b46\u8005":"\u512a\u6597, \u671d\u967d","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"12\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aeunittest%e3%81%a7%e3%81%ae%e3%83%a6%e3%83%8b%e3%83%83%e3%83%88%e3%83%86%e3%82%b9%e3%83%88%e3%81%ae%e4%be%8b\/","url":"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aeunittest%e3%81%a7%e3%81%ae%e3%83%a6%e3%83%8b%e3%83%83%e3%83%88%e3%83%86%e3%82%b9%e3%83%88%e3%81%ae%e4%be%8b\/","name":"Python\u306eunittest\u3067\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u4f8b - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website"},"datePublished":"2022-10-19T11:41:01+00:00","dateModified":"2025-07-31T17:34:14+00:00","author":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/cab7534c71201607a41f395de14d7d28"},"description":"Python\u306eunittest\u3067\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u4f8b\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u89e3\u8aac\u3002\u5b9f\u8df5\u7684\u306a\u4f8b\u3068\u30b3\u30fc\u30c9\u3001\u6ce8\u610f\u70b9\u3092\u542b\u3081\u3066\u521d\u5fc3\u8005\u306b\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u8aac\u660e\u3057\u307e\u3059\u3002","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aeunittest%e3%81%a7%e3%81%ae%e3%83%a6%e3%83%8b%e3%83%83%e3%83%88%e3%83%86%e3%82%b9%e3%83%88%e3%81%ae%e4%be%8b\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aeunittest%e3%81%a7%e3%81%ae%e3%83%a6%e3%83%8b%e3%83%83%e3%83%88%e3%83%86%e3%82%b9%e3%83%88%e3%81%ae%e4%be%8b\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aeunittest%e3%81%a7%e3%81%ae%e3%83%a6%e3%83%8b%e3%83%83%e3%83%88%e3%83%86%e3%82%b9%e3%83%88%e3%81%ae%e4%be%8b\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/ja\/blog\/"},{"@type":"ListItem","position":2,"name":"Python\u306eunittest\u3067\u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u306e\u4f8b"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#website","url":"https:\/\/www.silicloud.com\/ja\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"ja"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/cab7534c71201607a41f395de14d7d28","name":"\u512a\u6597, \u671d\u967d","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/56ecb1d20648a2ff67709eeaa7b6eddeb4d52aca0d46febc7f12bbef507187d0?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/56ecb1d20648a2ff67709eeaa7b6eddeb4d52aca0d46febc7f12bbef507187d0?s=96&d=mm&r=g","caption":"\u512a\u6597, \u671d\u967d"},"url":"https:\/\/www.silicloud.com\/ja\/blog\/author\/yutoasahi\/"},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/www.silicloud.com\/ja\/blog\/python%e3%81%aeunittest%e3%81%a7%e3%81%ae%e3%83%a6%e3%83%8b%e3%83%83%e3%83%88%e3%83%86%e3%82%b9%e3%83%88%e3%81%ae%e4%be%8b\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/799","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/comments?post=799"}],"version-history":[{"count":1,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/799\/revisions"}],"predecessor-version":[{"id":45157,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/posts\/799\/revisions\/45157"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/media?parent=799"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/categories?post=799"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/ja\/blog\/wp-json\/wp\/v2\/tags?post=799"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}