{"id":177943,"date":"2013-04-25T14:49:05","date_gmt":"2013-04-25T10:49:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=177943"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=177943","title":{"rendered":"<span class=\"post_title\">\u042f \u0431\u0443\u0434\u0443 \u043f\u0438\u0441\u0430\u0442\u044c unittest&#8217;\u044b\u2026 \u0443\u0436\u0435 \u0441\u0435\u0433\u043e\u0434\u043d\u044f<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u042f \u0431\u0443\u0434\u0443 \u043f\u0438\u0441\u0430\u0442\u044c unittest&#8217;\u044b\u2026<br \/>  \u042f \u0431\u0443\u0434\u0443 \u043f\u0438\u0441\u0430\u0442\u044c unittest&#8217;\u044b\u2026<br \/>  \u042f \u0431\u0443\u0434\u0443 \u043f\u0438\u0441\u0430\u0442\u044c unittest&#8217;\u044b\u2026<\/p>\n<p>  \u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e \u043d\u0435\u043f\u0440\u0438\u043b\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u044b\u043c \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a Python, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0439 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 <a href=\"http:\/\/docs.python.org\/2\/library\/unittest.html\">docs.python.org\/2\/library\/unittest.html<\/a> \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0440\u0430\u0431\u043e\u0442\u0435, \u043d\u0435 \u0432\u043d\u0438\u043a\u0430\u044f \u0433\u043b\u0443\u0431\u043e\u043a\u043e.<\/p>\n<h4>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h4>\n<p>  Unittest, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0430\u043a\u0436\u0435 \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 PyUnit \u2014 \u044d\u0442\u043e python-\u0432\u0435\u0440\u0441\u0438\u044f JUnit&#8217;\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u0432 Java \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 unit-\u0442\u0435\u0441\u0442\u043e\u0432. Java, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0432\u0437\u044f\u043b\u0430 \u043e\u0431\u0449\u0438\u0435 \u0438\u0434\u0435\u0438 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0443 SmallTalk&#8217;\u0430.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u044b<\/h4>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0434\u043e \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c:  <\/p>\n<ul>\n<li>test case \u2014 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0441\u0430\u043c \u0442\u0435\u0441\u0442;<\/li>\n<li>test fixture \u2014 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0440 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0435\u0441\u0442\u0430;<\/li>\n<li>test suite \u2014 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f case&#8217;\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u0432\u043c\u0435\u0441\u0442\u0435;<\/li>\n<li>test runner \u2014 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u0442\u0435\u0441\u0442\u043e\u0432 \u0438 \u0432\u044b\u0432\u043e\u0434\u044f\u0449\u0438\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u0434\u0430-\u0434\u0430, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e e-mail&#8217;\u0443).<\/li>\n<\/ul>\n<p>  <\/p>\n<h5>Test case<\/h5>\n<p>  TestCase, \u043a\u0430\u043a \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043a\u043b\u0430\u0441\u0441\u043e\u043c TestCase. \u0414\u043b\u044f TestCase \u043c\u043e\u0436\u043d\u043e (\u043d\u043e \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e) \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0430\u0442\u044c 2 \u043c\u0435\u0442\u043e\u0434\u0430:  <\/p>\n<ul>\n<li>setUp() \u2014 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u043f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0442\u0435\u0441\u0442\u043e\u0432. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u043a \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u041f\u041e, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0411\u0414 \u0438 \u0442.\u043f.;<\/li>\n<li>tearDown() \u2014 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u0430, \u0432\u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u041f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u043f\u0443\u043d\u043a\u0442\u043e\u043c, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u0411\u0414, \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u043a\u0430\u043a\u043e\u0433\u043e-\u0442\u043e \u041f\u041e \u0438 \u0442.\u043f.<\/li>\n<\/ul>\n<h5>Test fixture<\/h5>\n<p>  Test fixture \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u043a\u043b\u0430\u0441\u0441\u043e\u043c FunctionTestCase. \u0415\u0441\u043b\u0438 \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435, \u0447\u0442\u043e \u0432\u0430\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0439\/\u0432\u0441\u0442\u0430\u0432\u043e\u043a setUp()&#8217;\u0430, \u0437\u043d\u0430\u0447\u0438\u0442 \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u0430\u043c \u043f\u043e\u0440\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c Test fixture. \u0418\u043b\u0438 \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u044d\u0442\u0438 \u0436\u0435 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432.<\/p>\n<h5>Test suite<\/h5>\n<p>  Test Suite (\u0441\u044e\u0440\u043f\u0440\u0430\u0439\u0437!) \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 TestSuite. \u041e\u043d \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043a\u0430\u043a \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b, \u0442\u0430\u043a \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 TestSuite&#8217;\u044b. <\/p>\n<h5>Test runner<\/h5>\n<p>  \u041e\u0431\u044a\u0435\u043a\u0442 Test runner&#8217;\u0430 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043b\u0438\u0431\u043e TestCase \u043b\u0438\u0431\u043e TestSuite. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u2014 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 TestResult. \u0415\u0441\u043b\u0438 \u0440\u0430\u043d\u0435\u0440 \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c, \u0442\u043e \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f TextTestResult, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c. \u041c\u043e\u0436\u043d\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0432 \u0411\u0414, \u0432 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0432 \u043f\u0438\u0441\u044c\u043c\u043e, \u0434\u0430 \u0432\u043e\u043e\u0431\u0449\u0435 \u043a\u0443\u0434\u0430 \u0432\u0437\u0434\u0443\u043c\u0430\u0435\u0442\u0441\u044f, \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u044f \u043f\u043e\u0442\u043e\u043a\u0438 \u0432\u044b\u0432\u043e\u0434\u0430.<\/p>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440<\/h4>\n<p>  \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043d\u0430\u043b\u043e\u0433\u0430 \u043d\u0430 \u0434\u043e\u0445\u043e\u0434\u044b \u0444\u0438\u0437.\u043b\u0438\u0446 (13%), \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0439 \u0432 \u0444\u0430\u0439\u043b <b>fee.py<\/b>:<\/p>\n<pre><code class=\"python\">def fee(income):     try:         income = float(income)         return income*0.13     except ValueError:         return False     return False <\/code><\/pre>\n<p>  TestCase, \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0439 \u0432 \u0444\u0430\u0439\u043b\u0435 <b>test.py<\/b>, \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"python\"># -*- coding: utf-8 -*-    import unittest import random    from fee import fee    class FeeTestCase(unittest.TestCase):   \tdef test_number_income(self):   \t\t&quot;&quot;&quot;\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u043b\u0438 \u043b\u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434, \u0435\u0441\u043b\u0438 \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0447\u0438\u0441\u043b\u043e. &quot;&quot;&quot;   \t\tincome = random.randint(0,10000)   \t\tincome_fee = income*0.13   \t\tself.assertTrue(income_fee == fee(income), &quot;Fee function returns incorrent value.&quot;)       \tdef test_not_number_income(self):   \t\t&quot;&quot;&quot;\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u043b\u0438 \u043b\u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434, \u0435\u0441\u043b\u0438 \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u043d\u0435 \u0447\u0438\u0441\u043b\u043e. &quot;&quot;&quot;   \t\tincome = random.randint(0,10000)     \t\tstr_income = &quot;Text string&quot;   \t\tself.assertFalse(str_income == fee(income), &quot;Fee function returns incorrent value when string is income.&quot;)  <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438:<\/p>\n<pre><code class=\"bash\">$python -m unittest test <\/code><\/pre>\n<p>  \u041f\u043e\u043b\u0430\u0433\u0430\u044e, \u0447\u0442\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u043a\u043e\u0433\u0434\u0430 \u0442\u0435\u0441\u0442 \u043d\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442, \u0432\u044b \u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u043c \u0438 \u043b\u0435\u0433\u043a\u043e\u0441\u0442\u044c\u044e \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0438 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0445\u043e\u0434\u0430 \u043f\u043e \u0442\u0435\u0441\u0442\u0430\u043c:<\/p>\n<pre><code class=\"bash\">$ python -m unittest test .. ---------------------------------------------------------------------- Ran 2 tests in 0.000s      OK <\/code><\/pre>\n<h4>\u0420\u0430\u0437\u0431\u043e\u0440 \u043f\u0440\u0438\u043c\u0435\u0440\u0430<\/h4>\n<p>  \u0415\u0441\u043b\u0438 \u0432 TestCase&#8217;\u0435 \u0438\u043c\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441\u043e \u0441\u043b\u043e\u0432\u0430 test_, \u0442\u043e \u044d\u0442\u043e \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0442\u0435\u0441\u0442. \u041b\u044e\u0431\u043e\u0439 test_ \u0432 \u0441\u0432\u043e\u0435\u043c \u0442\u0435\u043b\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0438\u0437 assert&#8217;\u043e\u0432. \u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044d\u0442\u043e assertTrue \u0438 assertFalse (\u0441 \u043f\u043e\u043b\u043d\u044b\u043c \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435). \u0415\u0441\u043b\u0438 assert \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f, \u0442\u043e\u0433\u0434\u0430 \u0442\u0435\u0441\u0442 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u043d\u044b\u043c \u0443\u0441\u043f\u0435\u0448\u043d\u043e. \u0418\u043d\u0430\u0447\u0435 \u2014 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u043c \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 \u0438 \u0432\u044b\u0432\u043e\u0434\u043e\u043c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f assert&#8217;\u0443 \u0432\u0442\u043e\u0440\u044b\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c.<\/p>\n<h4>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0430\u0436\u043d\u044b\u0435 \u0444\u043b\u0430\u0433\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430<\/h4>\n<p>  <\/p>\n<ul>\n<li>-c \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 ctrl+c \u0434\u043e\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0442\u0435\u0441\u0442\u0430, \u0430 \u0437\u0430\u0442\u0435\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442;<\/li>\n<li>-v \u2014 \u0432\u044b\u0432\u043e\u0434 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0441 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u0435\u043c;<\/li>\n<li>-f \u2014 \u043f\u0440\u0435\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0436\u0435 \u0444\u0435\u0439\u043b\u0435.<\/li>\n<\/ul>\n<p>  \u042f \u043f\u0438\u0448\u0443 \u0442\u0435\u0441\u0442\u044b.<br \/>  \u042f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0443 \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b.<br \/>  (\u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c \u043f\u0435\u0440\u0435\u0434 \u0441\u043d\u043e\u043c \u043f\u0440\u043e \u0441\u0435\u0431\u044f)    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/177943\/\"> http:\/\/habrahabr.ru\/post\/177943\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u042f \u0431\u0443\u0434\u0443 \u043f\u0438\u0441\u0430\u0442\u044c unittest&#8217;\u044b\u2026<br \/>  \u042f \u0431\u0443\u0434\u0443 \u043f\u0438\u0441\u0430\u0442\u044c unittest&#8217;\u044b\u2026<br \/>  \u042f \u0431\u0443\u0434\u0443 \u043f\u0438\u0441\u0430\u0442\u044c unittest&#8217;\u044b\u2026<\/p>\n<p>  \u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u043e \u043d\u0435\u043f\u0440\u0438\u043b\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u044b\u043c \u0438\u0437\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a Python, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0439 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 <a href=\"http:\/\/docs.python.org\/2\/library\/unittest.html\">docs.python.org\/2\/library\/unittest.html<\/a> \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u043a \u0440\u0430\u0431\u043e\u0442\u0435, \u043d\u0435 \u0432\u043d\u0438\u043a\u0430\u044f \u0433\u043b\u0443\u0431\u043e\u043a\u043e.<\/p>\n<h4>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h4>\n<p>  Unittest, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0430\u043a\u0436\u0435 \u0438\u043d\u043e\u0433\u0434\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 PyUnit \u2014 \u044d\u0442\u043e python-\u0432\u0435\u0440\u0441\u0438\u044f JUnit&#8217;\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0433\u043e \u0432 Java \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 unit-\u0442\u0435\u0441\u0442\u043e\u0432. Java, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0432\u0437\u044f\u043b\u0430 \u043e\u0431\u0449\u0438\u0435 \u0438\u0434\u0435\u0438 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0443 SmallTalk&#8217;\u0430.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-177943","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/177943","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=177943"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/177943\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=177943"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=177943"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=177943"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}