{"id":22907,"date":"2022-04-14T17:00:31","date_gmt":"2022-04-14T12:30:31","guid":{"rendered":"https:\/\/parspack.com\/?p=22907"},"modified":"2024-08-23T23:38:32","modified_gmt":"2024-08-23T19:08:32","slug":"write-doctests-in-python","status":"publish","type":"post","link":"https:\/\/parspack.com\/blog\/cms\/write-doctests-in-python","title":{"rendered":"\u0646\u062d\u0648\u0647 \u0646\u0648\u0634\u062a\u0646 Doctest \u062f\u0631 \u067e\u0627\u06cc\u062a\u0648\u0646"},"content":{"rendered":"<p style=\"text-align: justify;\">\u062f\u0627\u06a9\u06cc\u0648\u0645\u0646\u062a \u0646\u0648\u06cc\u0633\u06cc \u0648 \u062a\u0633\u062a \u06a9\u062f \u062f\u0631 \u0641\u0631\u0622\u06cc\u0646\u062f \u062a\u0648\u0644\u06cc\u062f \u06cc\u06a9 \u0646\u0631\u0645 \u0627\u0641\u0632\u0627\u0631 \u0646\u0642\u0634 \u0627\u0633\u0627\u0633\u06cc \u0648 \u06a9\u0644\u06cc\u062f\u06cc \u0631\u0627 \u062f\u0627\u0631\u0646\u062f. \u062f\u0631 \u062d\u0642\u06cc\u0642\u062a \u0628\u0627 \u0622\u0632\u0645\u0627\u06cc\u0634 \u06a9\u062f\u060c \u0627\u06cc\u0646 \u0627\u0637\u0645\u06cc\u0646\u0627\u0646 \u062d\u0627\u0635\u0644 \u0645\u06cc\u200c\u0634\u0648\u062f \u06a9\u0647 \u0628\u0631\u0646\u0627\u0645\u0647 \u0628\u0647 \u062f\u0631\u0633\u062a\u06cc \u0627\u062c\u0631\u0627 \u062e\u0648\u0627\u0647\u062f \u0634\u062f. \u0647\u0645\u0686\u0646\u06cc\u0646 \u0628\u0627\u0639\u062b \u0627\u06cc\u062c\u0627\u062f \u0633\u0627\u0632\u06af\u0627\u0631\u06cc \u0628\u06cc\u0646 \u0628\u0631\u0646\u0627\u0645\u0647\u200c\u0646\u0648\u06cc\u0633\u06cc \u0648 \u0646\u06cc\u0627\u0632 \u06a9\u0627\u0631\u0628\u0631 \u0645\u06cc\u200c\u0634\u0648\u062f.<\/p>\n<p style=\"text-align: justify;\">\u062f\u0631 \u0648\u0627\u0642\u0639 \u0646\u0648\u0634\u062a\u0646\u0650 \u062f\u0627\u06a9\u06cc\u0648\u0645\u0646\u062a \u0648 \u062a\u0633\u062a \u0622\u0646 \u0642\u0628\u0644 \u0627\u0632 \u06a9\u062f\u0646\u0648\u06cc\u0633\u06cc \u0628\u0647 \u0628\u0631\u0646\u0627\u0645\u0647\u200c\u0646\u0648\u06cc\u0633 \u0628\u0633\u06cc\u0627\u0631 \u06a9\u0645\u06a9 \u0645\u06cc\u200c\u06a9\u0646\u062f. \u0632\u06cc\u0631\u0627 \u0628\u0631\u0646\u0627\u0645\u0647\u200c\u0646\u0648\u06cc\u0633 \u0628\u0627 \u0627\u0646\u062c\u0627\u0645 \u0627\u06cc\u0646 \u06a9\u0627\u0631 \u0627\u0637\u0645\u06cc\u0646\u0627\u0646 \u062d\u0627\u0635\u0644 \u0645\u06cc\u200c\u06a9\u0646\u062f \u06a9\u0647 \u062a\u0627\u0628\u0639 \u06a9\u062f\u0646\u0648\u06cc\u0633\u06cc \u0634\u062f\u0647(\u0628\u0637\u0648\u0631 \u0645\u062b\u0627\u0644)\u060c \u0628\u0647 \u062e\u0648\u0628\u06cc \u0628\u0631 \u0631\u0648\u06cc \u0622\u0646 \u0641\u06a9\u0631 \u0634\u062f\u0647 \u0648 \u062a\u0646\u0647\u0627 \u0628\u0647 \u0628\u0631\u0631\u0633\u06cc \u0645\u0648\u0627\u0631\u062f \u0627\u062d\u062a\u0645\u0627\u0644\u06cc \u0645\u06cc\u200c\u067e\u0631\u062f\u0627\u0632\u062f.<\/p>\n<p style=\"text-align: justify;\">\u0632\u0628\u0627\u0646 \u0628\u0631\u0646\u0627\u0645\u0647\u200c\u0646\u0648\u06cc\u0633\u06cc \u067e\u0627\u06cc\u062a\u0648\u0646 \u0627\u0632 \u062c\u0645\u0644\u0647 \u0632\u0628\u0627\u0646\u200c\u0647\u0627\u06cc programming \u0627\u0633\u062a \u06a9\u0647 \u0622\u0645\u0648\u0632\u0634 \u0648 \u06cc\u0627\u062f\u06af\u06cc\u0631\u06cc \u0628\u0633\u06cc\u0627\u0631 \u0631\u0627\u062d\u062a\u06cc \u062f\u0627\u0631\u062f. \u0627\u0632 \u0627\u06cc\u0646 \u0631\u0648 \u0628\u0633\u06cc\u0627\u0631\u06cc \u0627\u0632 \u062f\u0648\u0644\u0648\u067e\u0631\u0647\u0627 \u0627\u06cc\u0646 \u0632\u0628\u0627\u0646 \u0631\u0627 \u0628\u0647 \u0639\u0646\u0648\u0627\u0646 \u0627\u0648\u0644\u06cc\u0646 \u0632\u0628\u0627\u0646 \u0628\u0631\u0646\u0627\u0645\u0647 \u0646\u0648\u06cc\u0633\u06cc \u062e\u0648\u062f \u0627\u0646\u062a\u062e\u0627\u0628 \u0645\u06cc\u200c\u06a9\u0646\u0646\u062f. \u062f\u0631 \u062d\u0642\u06cc\u0642\u062a \u067e\u0627\u06cc\u062a\u0648\u0646 \u0628\u0647 \u0639\u0646\u0648\u0627\u0646 \u06cc\u06a9 \u0632\u0628\u0627\u0646 \u0647\u0645\u0647\u200c\u0645\u0646\u0638\u0648\u0631\u0647 \u062a\u0648\u0633\u0639\u0647 \u062f\u0627\u062f\u0647 \u0634\u062f\u0647 \u0648 \u0627\u0632 \u0622\u0646 \u0645\u06cc\u200c\u062a\u0648\u0627\u0646 \u0628\u0631\u0627\u06cc \u0647\u0631 \u06a9\u0627\u0631\u06cc \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0631\u062f.<\/p>\n<p style=\"text-align: justify;\">\u0632\u0628\u0627\u0646 \u0628\u0631\u0646\u0627\u0645\u0647 \u0646\u0648\u06cc\u0633\u06cc \u067e\u0627\u06cc\u062a\u0648\u0646 \u062f\u0627\u0631\u0627\u06cc \u0642\u0627\u0628\u0644\u06cc\u062a\u200c\u0647\u0627\u06cc \u0632\u06cc\u0627\u062f\u06cc \u0627\u0633\u062a. \u0627\u0632 \u062c\u0645\u0644\u0647 \u0627\u06cc\u0646 \u0642\u0627\u0628\u0644\u06cc\u062a\u200c\u0647\u0627 \u0645\u06cc\u200c\u062a\u0648\u0627\u0646 \u0628\u0647 \u0645\u0627\u0698\u0648\u0644\u0650 \u0641\u0631\u06cc\u0645\u0648\u0631\u06a9\u06cc \u0628\u0647 \u0646\u0627\u0645 Doctest \u0627\u0634\u0627\u0631\u0647 \u06a9\u0631\u062f. \u0627\u06cc\u0646 \u0645\u0627\u0698\u0648\u0644 \u0628\u0647 \u0635\u0648\u0631\u062a \u0628\u0631\u0646\u0627\u0645\u0647\u200c\u0646\u0648\u06cc\u0633\u06cc\u060c \u06a9\u062f \u067e\u0627\u06cc\u062a\u0648\u0646 \u0631\u0627 \u0628\u0631\u0627\u06cc \u0628\u062e\u0634\u200c\u0647\u0627\u06cc\u06cc \u0627\u0632 text \u062f\u0631 \u06a9\u0627\u0645\u0646\u062a\u200c\u0647\u0627 -\u06a9\u0647 \u0634\u0628\u06cc\u0647 \u0628\u0647 session\u0647\u0627\u06cc \u067e\u0627\u06cc\u062a\u0648\u0646 interactive \u0647\u0633\u062a\u0646\u062f- \u062c\u0633\u062a\u062c\u0648 \u0645\u06cc\u200c\u06a9\u0646\u062f. \u0633\u067e\u0633\u060c \u0645\u0627\u0698\u0648\u0644 \u0622\u0646 session\u0647\u0627 \u0631\u0627 \u0627\u062c\u0631\u0627 \u0645\u06cc\u200c\u06a9\u0646\u062f \u062a\u0627 \u062a\u0623\u06cc\u06cc\u062f \u06a9\u0646\u062f \u06a9\u0647 \u06a9\u062f \u0631\u0641\u0631\u0646\u0633 \u062f\u0627\u062f\u0647 \u0634\u062f\u0647 \u062a\u0648\u0633\u0637 Doctest\u060c \u0645\u0637\u0627\u0628\u0642 \u0627\u0646\u062a\u0638\u0627\u0631\u0627\u062a \u0627\u062c\u0631\u0627 \u0645\u06cc\u200c\u0634\u0648\u062f.<\/p>\n<p style=\"text-align: justify;\">\u0627\u0645\u0627 \u0686\u06af\u0648\u0646\u0647 \u0645\u06cc\u200c\u062a\u0648\u0627\u0646\u06cc\u0645 \u062f\u0631 \u067e\u0627\u06cc\u062a\u0648\u0646 Doctest \u0628\u0646\u0648\u06cc\u0633\u06cc\u0645\u061f \u062f\u0631 \u0627\u062f\u0627\u0645\u0647 \u0627\u06cc\u0646 \u0645\u0642\u0627\u0644\u0647 \u0627\u0632 \u067e\u0627\u0631\u0633 \u067e\u06a9 \u0628\u0647 \u0622\u0645\u0648\u0632\u0634 \u0642\u062f\u0645 \u0628\u0647 \u0642\u062f\u0645 \u0646\u062d\u0648\u0647 \u0646\u0648\u0634\u062a\u0646 Doctest \u0645\u06cc\u200c\u067e\u0631\u062f\u0627\u0632\u06cc\u0645. \u067e\u0633 \u0628\u0627 \u0645\u0627 \u0647\u0645\u0631\u0627\u0647 \u0628\u0627\u0634\u06cc\u062f.<\/p>\n<blockquote>\n<p style=\"text-align: center;\">\u0646\u06a9\u062a\u0647: \u0628\u0631\u0627\u06cc \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0642\u0627\u0628\u0644\u06cc\u062a Doctest \u0634\u0645\u0627 \u0628\u0627\u06cc\u062f \u0646\u062e\u0633\u062a \u067e\u0627\u06cc\u062a\u0648\u0646 3 \u0631\u0627 \u0646\u0635\u0628 \u06a9\u0631\u062f\u0647 \u0648 \u06cc\u06a9 \u0645\u062d\u06cc\u0637 \u0628\u0631\u0646\u0627\u0645\u0647 \u0646\u0648\u06cc\u0633\u06cc \u0631\u0627 \u0627\u06cc\u062c\u0627\u062f \u06a9\u0646\u06cc\u062f.<\/p>\n<\/blockquote>\n<h2 style=\"text-align: justify;\"><span style=\"color: #3366ff;\">\u0633\u0627\u062e\u062a\u0627\u0631 Doctest \u062f\u0631 \u067e\u0627\u06cc\u062a\u0648\u0646<\/span><\/h2>\n<p style=\"text-align: justify;\">\u0646\u0648\u0634\u062a\u0646 Doctest \u062f\u0631 \u067e\u0627\u06cc\u062a\u0648\u0646 \u0634\u0628\u06cc\u0647 \u0628\u0647 \u0646\u0648\u0634\u062a\u0646 \u06cc\u06a9 \u06a9\u0627\u0645\u0646\u062a \u0627\u0633\u062a\u060c \u0628\u0627 \u0627\u06cc\u0646 \u062a\u0641\u0627\u0648\u062a \u06a9\u0647 \u0633\u0647 \u0639\u0644\u0627\u0645\u062a \u06a9\u0648\u062a\u06cc\u0634\u0646 (&#8220;&#8221;&#8221;) \u062f\u0631 \u0627\u0628\u062a\u062f\u0627 \u0648 \u0627\u0646\u062a\u0647\u0627\u06cc \u0622\u0646 \u0642\u0631\u0627\u0631 \u0645\u06cc\u200c\u06af\u06cc\u0631\u062f. \u06af\u0627\u0647\u06cc Doctest\u0647\u0627 \u0628\u0627 \u0645\u062b\u0627\u0644\u06cc \u0627\u0632 \u062a\u0627\u0628\u0639 \u0648 \u062e\u0631\u0648\u062c\u06cc \u0645\u0648\u0631\u062f \u0627\u0646\u062a\u0638\u0627\u0631 \u0646\u0648\u0634\u062a\u0647 \u0645\u06cc\u200c\u0634\u0648\u0646\u062f. \u0627\u0645\u0627 \u0628\u0631\u062e\u06cc \u0627\u0648\u0642\u0627\u062a \u0634\u0627\u06cc\u062f \u062a\u0648\u0636\u06cc\u062d\u0627\u062a\u06cc \u0646\u06cc\u0632 \u062f\u0631 \u0645\u0648\u0631\u062f \u0622\u0646\u0686\u0647 \u06a9\u0647 \u062a\u0627\u0628\u0639 \u0642\u0635\u062f \u0627\u0646\u062c\u0627\u0645 \u0622\u0646 \u0631\u0627 \u062f\u0627\u0631\u062f \u0646\u06cc\u0632 \u0622\u0648\u0631\u062f\u0647 \u0634\u0648\u062f.<\/p>\n<p style=\"text-align: justify;\">\u062f\u0631\u062c comment \u0646\u0634\u0627\u0646 \u0645\u06cc\u200c\u062f\u0647\u062f \u06a9\u0647 \u0634\u0645\u0627 \u0628\u0647 \u0639\u0646\u0648\u0627\u0646 \u0628\u0631\u0646\u0627\u0645\u0647\u200c\u0646\u0648\u06cc\u0633 \u0627\u0647\u062f\u0627\u0641 \u062e\u0648\u062f \u0631\u0627 \u0648\u0627\u0636\u062d\u200c\u062a\u0631 \u0628\u06cc\u0627\u0646 \u06a9\u0631\u062f\u0647\u200c\u0627\u06cc\u062f \u0648 \u0641\u0631\u062f\u06cc \u06a9\u0647 \u06a9\u062f \u0631\u0627 \u0645\u06cc\u200c\u062e\u0648\u0627\u0646\u062f \u0622\u0646 \u0631\u0627 \u0628\u0647 \u062e\u0648\u0628\u06cc \u062f\u0631\u06a9 \u0645\u06cc\u200c\u06a9\u0646\u062f. \u0628\u0647 \u0628\u06cc\u0627\u0646\u06cc \u0639\u0627\u0645\u0647\u200c\u062a\u0631\u060c \u06cc\u06a9\u06cc \u0627\u0632 \u0634\u0631\u0627\u06cc\u0637 \u06a9\u062f\u0632\u0646\u06cc \u062a\u0645\u06cc\u0632 \u0648 \u0645\u0631\u062a\u0628\u060c \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0628\u0647 \u0645\u0648\u0642\u0639 \u0627\u0632 \u06a9\u0627\u0645\u0646\u062a \u0647\u0627 \u0628\u0631\u0627\u06cc \u0627\u0631\u0627\u0626\u0647 \u062a\u0648\u0636\u06cc\u062d\u0627\u062a \u0644\u0627\u0632\u0645 \u0627\u0633\u062a!<\/p>\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" data-loaded=\"true\" src=\"https:\/\/parspack.com\/blog\/wp-content\/uploads\/2022\/04\/Doctest-in-Python-2.jpg\" class=\"wp-image-22912 size-full\" alt=\"\u0633\u0627\u062e\u062a\u0627\u0631 doctest python\" title=\"\u0622\u0645\u0648\u0632\u0634 \u0633\u0627\u062e\u062a\u0627\u0631 doctest python\"       width=\"650\" height=\"400\" srcset=\"https:\/\/parspack.com\/blog\/wp-content\/uploads\/2022\/04\/Doctest-in-Python-2.jpg 650w, https:\/\/parspack.com\/blog\/wp-content\/uploads\/2022\/04\/Doctest-in-Python-2-300x185.jpg 300w\" sizes=\"auto, (max-width: 650px) 100vw, 650px\" \/><figcaption class=\"text-subtitle-5 text-gray-9 text-center mt-2\" >\u0622\u0645\u0648\u0632\u0634 doctest python \u0648 \u0633\u0627\u062e\u062a\u0627\u0631 \u0622\u0646<\/figcaption><\/figure>\n<blockquote>\n<p style=\"text-align: center;\">\u0646\u06a9\u062a\u0647: \u0628\u0631\u0627\u06cc \u0627\u06cc\u0646\u06a9\u0647 \u062f\u0631 \u0637\u0648\u0644 \u0627\u062c\u0631\u0627\u06cc \u0645\u062b\u0627\u0644 \u0627\u06cc\u0646 \u0645\u0642\u0627\u0644\u0647 \u0622\u0645\u0648\u0632\u0634\u06cc \u0628\u0627 \u0645\u0627 \u0647\u0645\u0631\u0627\u0647 \u0628\u0627\u0634\u06cc\u062f\u060c \u06cc\u06a9 Python interactive shell \u0631\u0627 \u062f\u0631 \u0633\u06cc\u0633\u062a\u0645 \u0644\u0648\u06a9\u0627\u0644 \u062e\u0648\u062f\u061b \u0628\u0627 \u0627\u062c\u0631\u0627\u06cc \u062f\u0633\u062a\u0648\u0631 Python3\u061b \u0628\u0627\u0632 \u06a9\u0646\u06cc\u062f. \u062d\u0627\u0644 \u0628\u0627 \u0627\u0636\u0627\u0641\u0647 \u06a9\u0631\u062f\u0646 \u0645\u062b\u0627\u0644\u200c\u0647\u0627 \u0628\u0639\u062f \u0627\u0632 &lt;&lt;&lt; \u0645\u06cc\u200c\u062a\u0648\u0627\u0646\u06cc\u062f \u0622\u0646\u0647\u0627 \u0631\u0627 \u06a9\u067e\u06cc\u060c \u067e\u06cc\u0633\u062a \u0648\u06cc\u0627 \u0627\u062f\u06cc\u062a \u06a9\u0646\u06cc\u062f.<\/p>\n<\/blockquote>\n<p style=\"text-align: justify;\">\u062f\u0631 \u0627\u062f\u0627\u0645\u0647 \u06cc\u06a9 \u0645\u062b\u0627\u0644 \u0631\u06cc\u0627\u0636\u06cc \u0627\u0632 Doctest \u0628\u0631\u0627\u06cc \u062a\u0627\u0628\u0639\u06cc \u0645\u0627\u0646\u0646\u062f add(a,b) \u0631\u0627 \u062f\u0631 \u0646\u0638\u0631 \u0645\u06cc\u200c\u06af\u06cc\u0631\u06cc\u0645 \u06a9\u0647 \u062f\u0648 \u0639\u062f\u062f \u0631\u0627 \u0628\u0627 \u0647\u0645 \u062c\u0645\u0639 \u0645\u06cc\u200c\u06a9\u0646\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">\"\"\"\r\nGiven two integers, return the sum.\r\n\r\n&gt;&gt;&gt; add (2, 3)\r\n5\r\n\"\"\"<\/pre>\n<p style=\"text-align: justify;\">\u0627\u06cc\u0646 \u0645\u062b\u0627\u0644 \u0634\u0627\u0645\u0644 \u06cc\u06a9 \u062e\u0637 \u062a\u0648\u0636\u06cc\u062d(explanation)\u060c \u06cc\u06a9 \u0645\u062b\u0627\u0644 \u0627\u0632 \u062a\u0627\u0628\u0639 ()add \u0628\u0627 \u062f\u0648 \u0639\u062f\u062f \u0635\u062d\u06cc\u062d \u0628\u0639\u0646\u0648\u0627\u0646 \u0645\u0642\u0627\u062f\u06cc\u0631 \u0648\u0631\u0648\u062f\u06cc(input) \u0627\u0633\u062a. \u0627\u06af\u0631 \u0642\u0635\u062f \u062f\u0627\u0631\u06cc\u062f \u062f\u0631 \u0622\u06cc\u0646\u062f\u0647 \u0628\u06cc\u0634 \u0627\u0632 2 \u0639\u062f\u062f \u0635\u062d\u06cc\u062d \u0631\u0627 \u0628\u0648\u0633\u06cc\u0644\u0647 \u0627\u06cc\u0646 \u062a\u0627\u0628\u0639 \u062c\u0645\u0639 \u06a9\u0646\u06cc\u062f\u060c \u0628\u0627\u06cc\u062f Doctest \u0631\u0627 \u0628\u0627 \u062a\u0648\u062c\u0647 \u0628\u0647 \u0648\u0631\u0648\u062f\u06cc\u200c\u0647\u0627\u06cc \u062a\u0627\u0628\u0639 \u062e\u0648\u062f \u062a\u063a\u06cc\u06cc\u0631 \u062f\u0647\u06cc\u062f.<\/p>\n<p style=\"text-align: justify;\">\u062f\u0627\u06a9\u062a\u0633\u062a \u0641\u0639\u0644\u06cc \u062a\u0627 \u0628\u062f\u06cc\u0646 \u0644\u062d\u0638\u0647 \u06a9\u0627\u0645\u0644\u0627 \u0628\u0631\u0627\u06cc \u0647\u0631 \u0641\u0631\u062f\u06cc \u0642\u0627\u0628\u0644 \u062e\u0648\u0627\u0646\u062f\u0646 \u0645\u06cc\u200c\u0628\u0627\u0634\u062f. \u0627\u0645\u0627 \u0645\u06cc\u200c\u062a\u0648\u0627\u0646 \u0627\u06cc\u0646 docstring \u0631\u0627 \u0628\u0627 \u067e\u0627\u0631\u0627\u0645\u062a\u0631\u0647\u0627\u06cc machine-readable \u0648 \u06cc\u06a9 return description -\u0628\u0631\u0627\u06cc \u0631\u0648\u0634\u0646\u200c\u0633\u0627\u0632\u06cc \u0645\u062a\u063a\u06cc\u0631\u0647\u0627\u06cc \u0648\u0631\u0648\u062f\u06cc\/\u062e\u0631\u0648\u062c\u06cc \u0628\u0647 \u0627\u06cc\u0646 \u062a\u0627\u0628\u0639- \u062a\u06a9\u0631\u0627\u0631 \u06a9\u0631\u062f.<\/p>\n<p style=\"text-align: justify;\">\u062f\u0631 \u0627\u062f\u0627\u0645\u0647\u060c docstring\u0647\u0627\u06cc\u06cc \u0631\u0627 \u0628\u0631\u0627\u06cc \u062f\u0648 \u0622\u0631\u06af\u0648\u0645\u0627\u0646 \u0627\u0631\u0633\u0627\u0644 \u0634\u062f\u0647 \u0628\u0647 \u062a\u0627\u0628\u0639 \u0648 \u0645\u0642\u062f\u0627\u0631 \u0628\u0631\u06af\u0634\u062a\u06cc(returned value)\u060c \u0627\u0636\u0627\u0641\u0647 \u0645\u06cc\u200c\u06a9\u0646\u06cc\u0645. \u062f\u0627\u06a9\u200c\u0627\u0633\u062a\u0631\u06cc\u0646\u06af \u0627\u0646\u0648\u0627\u0639 \u062f\u06cc\u062a\u0627 \u0631\u0627 \u0628\u0631\u0627\u06cc \u0647\u0631 \u06cc\u06a9 \u0627\u0632 value\u0647\u0627 &#8211; \u067e\u0627\u0631\u0627\u0645\u062a\u0631 a\u060c \u067e\u0627\u0631\u0627\u0645\u062a\u0631 b \u0648 returned value &#8211; \u06cc\u0627\u062f\u062f\u0627\u0634\u062a \u0645\u06cc\u200c\u06a9\u0646\u062f. \u062f\u0631 \u0627\u06cc\u0646 \u0645\u0648\u0631\u062f \u0647\u0645\u0647 \u067e\u0627\u0631\u0627\u0645\u062a\u0631\u0647\u0627 \u0627\u0639\u062f\u0627\u062f \u0635\u062d\u06cc\u062d \u0647\u0633\u062a\u0646\u062f.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">\"\"\"\r\nGiven two integers, return the sum.\r\n\r\n:param a: int\r\n:param b: int\r\n:return: int\r\n\r\n&gt;&gt;&gt; add(2, 3)\r\n5\r\n\"\"\"<\/pre>\n<p style=\"text-align: justify;\">\u062e\u0628 \u0627\u06a9\u0646\u0648\u0646 Doctest \u0622\u0645\u0627\u062f\u0647 \u0627\u0633\u062a \u062a\u0627 \u062f\u0631 \u06cc\u06a9 \u062a\u0627\u0628\u0639 \u0642\u0631\u0627\u0631 \u06af\u06cc\u0631\u062f \u0648 \u062a\u0633\u062a \u0634\u0648\u062f.<\/p>\n<h2 style=\"text-align: justify;\"><span style=\"color: #3366ff;\">\u06af\u0646\u062c\u0627\u0646\u062f\u0646 Doctest \u062f\u0631 \u06cc\u06a9 \u062a\u0627\u0628\u0639<\/span><\/h2>\n<p style=\"text-align: justify;\">Doctest\u0647\u0627 \u0645\u0639\u0645\u0648\u0644\u0627\u064b \u062f\u0631 \u062f\u0627\u062e\u0644 \u06cc\u06a9 \u062a\u0627\u0628\u0639 \u0628\u0639\u062f \u0627\u0632 \u062f\u0633\u062a\u0648\u0631 def \u0648 \u0642\u0628\u0644 \u0627\u0632 \u06a9\u062f\u0650 \u062a\u0627\u0628\u0639 \u0642\u0631\u0627\u0631 \u0645\u06cc\u200c\u06af\u06cc\u0631\u0646\u062f. \u067e\u06cc\u0631\u0648 \u062a\u0639\u0631\u06cc\u0641 \u0627\u0648\u0644\u06cc\u0647 \u062a\u0627\u0628\u0639\u060c \u0637\u0628\u0642 \u0642\u0631\u0627\u0631\u062f\u0627\u062f\u0647\u0627\u06cc \u067e\u0627\u06cc\u062a\u0648\u0646 \u062a\u0648\u0631\u0641\u062a\u06af\u06cc\u200c\u0647\u0627\u06cc\u06cc \u062e\u0648\u0627\u0647\u062f \u062f\u0627\u0634\u062a. \u0627\u06cc\u0646 \u062a\u0627\u0628\u0639 \u06a9\u0648\u062a\u0627\u0647 \u0646\u0634\u0627\u0646 \u0645\u06cc\u200c\u062f\u0647\u062f \u06a9\u0647 \u06cc\u06a9 \u062f\u0627\u06a9\u062a\u0633\u062a \u0686\u0637\u0648\u0631 \u062f\u0631 \u0622\u0646 \u06af\u0646\u062c\u0627\u0646\u062f\u0647 \u0645\u06cc\u200c\u0634\u0648\u062f.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def add(a, b):\r\n\"\"\"\r\nGiven two integers, return the sum.\r\n\r\n:param a: int\r\n:param b: int\r\n:return: int\r\n\r\n&gt;&gt; add(2, 3)\r\n5\r\n\"\"\"\r\nreturn a + b<\/pre>\n<p style=\"text-align: justify;\">\u0627\u06a9\u0646\u0648\u0646 \u06cc\u06a9 \u062a\u0627\u0628\u0639 \u0631\u0627 \u062f\u0627\u0631\u06cc\u062f\u060c \u0628\u0646\u0627\u0628\u0631\u0627\u06cc\u0646 \u0628\u0627\u06cc\u062f \u0645\u0627\u0698\u0648\u0644 Doctest \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f \u0648 \u06cc\u06a9 \u062f\u0633\u062a\u0648\u0631 \u0628\u0631\u0627\u06cc \u0627\u062c\u0631\u0627\u06cc \u0622\u0646 \u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u06cc\u062f.<\/p>\n<p style=\"text-align: justify;\">\u0628\u0647 \u0647\u0645\u06cc\u0646 \u0645\u0646\u0638\u0648\u0631 \u0628\u0627\u06cc\u062f \u062a\u0648\u0636\u06cc\u062d\u0627\u062a \u0632\u06cc\u0631 \u0631\u0627 \u0628\u0647 \u0642\u0628\u0644 \u0648 \u0628\u0639\u062f \u062a\u0627\u0628\u0639 \u062e\u0648\u062f \u0627\u0636\u0627\u0641\u0647 \u06a9\u0646\u06cc\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import Doctest\r\n...\r\nDoctest .testmod()<\/pre>\n<p style=\"text-align: justify;\">\u062f\u0631 \u0627\u06cc\u0646 \u0645\u0631\u062d\u0644\u0647\u060c \u0628\u0647 \u062c\u0627\u06cc \u0630\u062e\u06cc\u0631\u0647 \u0622\u0646 \u062f\u0631 \u0641\u0627\u06cc\u0644 \u0628\u0631\u0646\u0627\u0645\u0647\u060c \u0622\u0646 \u0631\u0627 \u0631\u0648\u06cc Python shell \u062a\u0633\u062a \u06a9\u0646\u06cc\u062f. \u0628\u0631\u0627\u06cc \u0627\u0646\u062c\u0627\u0645 \u0627\u06cc\u0646 \u06a9\u0627\u0631 \u0645\u06cc\u200c\u062a\u0648\u0627\u0646\u06cc\u062f \u0627\u0632 \u062f\u0633\u062a\u0648\u0631 python3 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0646\u0645\u0627\u06cc\u06cc\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ python3<\/pre>\n<p style=\"text-align: justify;\">\u0627\u06af\u0631 \u0627\u06cc\u0646 \u0645\u0633\u06cc\u0631 \u0631\u0627 \u0628\u0631\u0627\u06cc \u0627\u062c\u0631\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u062f\u060c \u067e\u0633 \u0627\u0632 \u0641\u0634\u0627\u0631 \u062f\u0627\u062f\u0646 \u06a9\u0644\u06cc\u062f Enter \u062f\u0631 \u06a9\u06cc\u0628\u0648\u0631\u062f \u062e\u0648\u062f \u062e\u0631\u0648\u062c\u06cc \u0645\u0634\u0627\u0628\u0647 \u0632\u06cc\u0631 \u0631\u0627 \u062f\u0631\u06cc\u0627\u0641\u062a \u0645\u06cc\u200c\u06a9\u0646\u06cc\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Output\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n&gt;&gt;&gt;<\/pre>\n<p style=\"text-align: justify;\">\u067e\u0633 \u0627\u0632 \u0639\u0644\u0627\u0645\u062a &lt;&lt;&lt; \u0645\u06cc\u200c\u062a\u0648\u0627\u0646\u06cc\u062f \u062a\u0627\u06cc\u067e\u0650 \u06a9\u062f\u0650 \u0645\u0648\u0631\u062f \u0646\u0638\u0631 \u062e\u0648\u062f \u0631\u0627 \u0634\u0631\u0648\u0639 \u06a9\u0646\u06cc\u062f.<\/p>\n<p style=\"text-align: justify;\">\u06a9\u062f \u06a9\u0627\u0645\u0644 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0634\u062f\u0647 \u062f\u0631 \u0627\u06cc\u0646 \u0645\u062b\u0627\u0644 \u0634\u0627\u0645\u0644 \u062a\u0627\u0628\u0639 ()function \u0628\u0627 \u062f\u0627\u06a9\u062a\u0633\u062a\u060c \u062f\u0627\u06a9\u200c\u0627\u0633\u062a\u0631\u06cc\u0646\u06af \u0648 \u06cc\u06a9 \u0641\u0631\u0627\u062e\u0648\u0627\u0646(call) \u0628\u0631\u0627\u06cc \u0627\u0633\u062a\u0646\u0627\u062f \u0628\u0647 \u062f\u0627\u06a9\u062a\u0633\u062a \u0645\u06cc\u200c\u0628\u0627\u0634\u062f. \u062d\u0627\u0644 \u0622\u0646 \u0631\u0627 \u0628\u0647 \u0645\u062a\u0631\u062c\u0645 \u067e\u0627\u06cc\u062a\u0648\u0646 \u062e\u0648\u062f paste \u06a9\u0646\u06cc\u062f \u062a\u0627 \u0622\u0646 \u0631\u0627 \u062f\u0631 \u0628\u0648\u062a\u0647 \u0622\u0632\u0645\u0627\u06cc\u0634 \u0642\u0631\u0627\u0631 \u062f\u0647\u06cc\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import Doctest\r\n\r\ndef add(a, b):\r\n\"\"\"\r\nGiven two integers, return the sum.\r\n\r\n:param a: int\r\n:param b: int\r\n:return: int\r\n\r\n&gt;&gt;&gt; add(2, 3)\r\n5\r\n\"\"\"\r\nreturn a + b\r\n\r\nDoctest .testmod()<\/pre>\n<p style=\"text-align: justify;\">\u067e\u0633 \u0627\u0632 \u0627\u062c\u0631\u0627\u06cc \u06a9\u062f \u062e\u0631\u0648\u062c\u06cc \u0632\u06cc\u0631 \u0631\u0627 \u062f\u0631\u06cc\u0627\u0641\u062a \u062e\u0648\u0627\u0647\u06cc\u062f \u06a9\u0631\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Output\r\nTestResults(failed=0, attempted=1)<\/pre>\n<p style=\"text-align: justify;\">\u0627\u06cc\u0646 \u0628\u062f\u0627\u0646 \u0645\u0639\u0646\u0627 \u0627\u0633\u062a \u06a9\u0647 \u06a9\u062f \u0645\u0648\u0631\u062f \u0646\u0638\u0631 \u0628\u0631 \u0637\u0628\u0642 \u0627\u0646\u062a\u0638\u0627\u0631\u0627\u062a \u0634\u0645\u0627 \u0627\u062c\u0631\u0627 \u0634\u062f!<\/p>\n<p style=\"text-align: justify;\">\u062f\u0642\u062a \u062f\u0627\u0634\u062a\u0647 \u0628\u0627\u0634\u06cc\u062f \u06a9\u0647 \u0627\u06af\u0631 \u062f\u0631 \u0628\u0631\u0646\u0627\u0645\u0647 \u0628\u0627\u0644\u0627 \u0645\u062c\u0645\u0648\u0639 \u062f\u0648 \u0639\u062f\u062f \u0635\u062d\u06cc\u062d a + b\u060c \u0628\u0647 \u0636\u0631\u0628 \u062f\u0648 \u0639\u062f\u062f a * b \u062a\u063a\u06cc\u06cc\u0631 \u067e\u06cc\u062f\u0627 \u06a9\u0646\u062f\u060c \u06cc\u06a9 \u0627\u0639\u0644\u0627\u0646 \u0627\u0632 \u0645\u0648\u0641\u0642\u200c\u0622\u0645\u06cc\u0632 \u0646\u0628\u0648\u062f\u0646 \u0622\u0646 \u062f\u0631\u06cc\u0627\u0641\u062a \u062e\u0648\u0627\u0647\u06cc\u062f \u06a9\u0631\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">**********************************************************************\r\nFile \"__main__\", line 9, in __main__.add\r\nFailed example:\r\n    add(2, 3)\r\nExpected:\r\n    5\r\nGot:\r\n    6\r\n**********************************************************************\r\n1 items had failures:\r\n   1 of   1 in __main__.add\r\n***Test Failed*** 1 failures.\r\nTestResults(failed=1, attempted=1)<\/pre>\n<p style=\"text-align: justify;\">\u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0645\u062b\u0627\u0644 \u0628\u0627\u0644\u0627 \u0645\u06cc\u200c\u062a\u0648\u0627\u0646\u06cc\u062f \u0627\u0647\u0645\u06cc\u062a \u0645\u0627\u0698\u0648\u0644 Doctest \u0631\u0627 \u062f\u0631\u06a9 \u06a9\u0646\u06cc\u062f. \u0632\u06cc\u0631\u0627 \u06a9\u0627\u0645\u0644 \u0628\u0631\u0627\u06cc \u0634\u0645\u0627 \u0646\u0634\u0627\u0646 \u062f\u0627\u062f\u0647 \u062e\u0648\u0627\u0647\u062f \u0634\u062f \u06a9\u0647 \u0686\u0647 \u0627\u062a\u0641\u0627\u0642\u06cc \u0631\u062e\u200c\u062f\u0627\u062f\u0647 \u0627\u0633\u062a. \u0645\u0645\u06a9\u0646 \u0627\u0633\u062a \u0628\u062e\u0648\u0627\u0647\u06cc\u062f \u0645\u062b\u0627\u0644\u200c\u0647\u0627\u06cc \u0628\u06cc\u0634\u062a\u0631\u06cc \u0631\u0627 \u0628\u0631\u0631\u0633\u06cc \u06a9\u0646\u06cc\u062f. \u0628\u0631\u0627\u06cc \u0645\u062b\u0627\u0644 \u0645\u0642\u062f\u0627\u0631 a \u0648 b \u0631\u0627 \u0635\u0641\u0631 \u062f\u0631 \u0646\u0638\u0631 \u0628\u06af\u06cc\u0631\u06cc\u062f \u0648 \u0633\u067e\u0633 \u0645\u062c\u0645\u0648\u0639 \u0622\u0646\u0647\u0627 \u0631\u0627 \u0628\u0627 \u0639\u0645\u0644\u06af\u0631 + \u0628\u062f\u0633\u062a \u0622\u0648\u0631\u06cc\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import Doctest\r\n\r\ndef add(a, b):\r\n\"\"\"\r\nGiven two integers, return the sum.\r\n\r\n:param a: int\r\n:param b: int\r\n:return: int\r\n\r\n&gt;&gt;&gt; add(2, 3)\r\n5\r\n&gt;&gt;&gt; add(0, 0)\r\n0\r\n\"\"\"\r\nreturn a + b\r\n\r\nDoctest .testmod()<\/pre>\n<p style=\"text-align: justify;\">\u067e\u0633 \u0627\u0632 \u0627\u062c\u0631\u0627 \u0641\u06cc\u062f\u0628\u06a9 \u0632\u06cc\u0631 \u0631\u0627 \u0627\u0632 \u0645\u062a\u0631\u062c\u0645 \u067e\u0627\u06cc\u062a\u0648\u0646 \u062f\u0631\u06cc\u0627\u0641\u062a \u062e\u0648\u0627\u0647\u06cc\u062f \u06a9\u0631\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">TestResults(failed=0, attempted=2)<\/pre>\n<p style=\"text-align: justify;\">\u0627\u06cc\u0646 \u062e\u0631\u0648\u062c\u06cc \u0646\u0634\u0627\u0646 \u0645\u06cc\u200c\u062f\u0647\u062f \u06a9\u0647 Doctest \u062f\u0648 \u062a\u0633\u062a \u0631\u0627 \u0627\u0646\u062c\u0627\u0645 \u062f\u0627\u062f\u0647 \u0627\u0633\u062a. \u06cc\u06a9\u06cc \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 \u062d\u0627\u0635\u0644 \u062c\u0645\u0639 add(2,3) \u0648 \u062f\u06cc\u06af\u0631 \u0645\u0631\u0628\u0648\u0637 \u0628\u0647 add(0,0) \u0627\u0633\u062a. \u0647\u0631 \u062f\u0648 \u062d\u0627\u0635\u0644 \u0628\u062f\u0631\u0633\u062a\u06cc \u0628\u062f\u0633\u062a \u0622\u0645\u062f\u0647\u200c\u0627\u0646\u062f.<\/p>\n<p style=\"text-align: justify;\">\u0627\u06af\u0631 \u062f\u0648\u0628\u0627\u0631\u0647 \u0628\u0631\u0646\u0627\u0645\u0647 \u0631\u0627 \u0628\u0647 \u0635\u0648\u0631\u062a\u06cc \u062a\u063a\u06cc\u06cc\u0631 \u062f\u0647\u06cc\u062f \u06a9\u0647 \u0627\u0632 \u0639\u0645\u0644\u06af\u0631 \u0636\u0631\u0628 * \u0628\u0647 \u062c\u0627\u06cc \u0639\u0645\u0644\u06af\u0631 + \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u062f\u060c \u0645\u06cc\u200c\u062a\u0648\u0627\u0646\u06cc\u062f \u0628\u0647 \u0627\u0647\u0645\u06cc\u062a edge case\u0647\u0627 \u062f\u0631 \u0645\u0627\u0698\u0648\u0644 Doctest \u067e\u06cc \u0628\u0628\u0631\u06cc\u062f. \u0632\u06cc\u0631\u0627 \u062f\u0631 \u0645\u062b\u0627\u0644 \u062f\u0648\u0645\u060c add(0,0) \u0645\u0642\u062f\u0627\u0631 \u0645\u0634\u0627\u0628\u0647\u06cc \u0631\u0627 \u0628\u0631\u06af\u0634\u062a \u062e\u0648\u0627\u0647\u062f \u062f\u0627\u062f( \u0686\u0647 \u0636\u0631\u0628 \u0648 \u0686\u0647 \u062c\u0645\u0639 \u0628\u0627\u0634\u062f).<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">import Doctest\r\n\r\ndef add(a, b):\r\n\"\"\"\r\nGiven two integers, return the sum.\r\n\r\n:param a: int\r\n:param b: int\r\n:return: int\r\n\r\n&gt;&gt;&gt; add(2, 3)\r\n5\r\n&gt;&gt;&gt; add(0, 0)\r\n0\r\n\"\"\"\r\nreturn a * b\r\n\r\nDoctest .testmod()<\/pre>\n<p style=\"text-align: justify;\">\u0627\u06a9\u0646\u0648\u0646 \u062e\u0631\u0648\u062c\u06cc \u067e\u06cc\u0631\u0648 \u0628\u0631\u06af\u0634\u062a \u062f\u0627\u062f\u0647 \u0645\u06cc\u200c\u0634\u0648\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">**********************************************************************\r\nFile \"__main__\", line 9, in __main__.add\r\nFailed example:\r\nadd(2, 3)\r\nExpected:\r\n5\r\nGot:\r\n6\r\n**********************************************************************\r\n1 items had failures:\r\n1 of 2 in __main__.add\r\n***Test Failed*** 1 failures.\r\nTestResults(failed=1, attempted=2)<\/pre>\n<p style=\"text-align: justify;\">\u0647\u0646\u06af\u0627\u0645\u06cc \u06a9\u0647 \u062a\u063a\u06cc\u06cc\u0631\u0627\u062a\u06cc \u062f\u0631 \u0628\u0631\u0646\u0627\u0645\u0647 \u0627\u06cc\u062c\u0627\u062f \u0645\u06cc\u200c\u06a9\u0646\u06cc\u062f\u060c \u0634\u0627\u06cc\u062f \u0628\u0631\u0627\u06cc \u06cc\u06a9\u06cc \u0627\u0632 \u0645\u062b\u0627\u0644\u200c\u0647\u0627 \u062e\u0637\u0627 \u0627\u06cc\u062c\u0627\u062f \u0628\u06af\u06cc\u0631\u06cc\u062f\u060c \u0627\u0645\u0627 \u062f\u0631 \u062d\u0627\u0644\u062a \u06a9\u0644\u06cc \u0645\u0631\u0627\u062d\u0644 \u0645\u0627\u0646\u0646\u062f \u0642\u0628\u0644 \u0627\u062c\u0631\u0627 \u0634\u0648\u0646\u062f. \u067e\u0633 \u062f\u0642\u062a \u06a9\u0646\u06cc\u062f \u06a9\u0647 \u0648\u062c\u0648\u062f \u062a\u063a\u06cc\u06cc\u0631\u0627\u062a \u06a9\u0648\u0686\u06a9 \u062f\u0631 \u0628\u0631\u0646\u0627\u0645\u0647 \u0628\u0627\u0639\u062b \u0627\u06cc\u062c\u0627\u062f \u0641\u0631\u0635\u062a\u200c\u0647\u0627\u06cc\u06cc \u0628\u0631\u0627\u06cc \u0634\u06a9\u0633\u062a \u06cc\u0627 \u0627\u062c\u0631\u0627 \u0646\u0634\u062f\u0646 \u0622\u0646 \u062e\u0648\u0627\u0647\u062f \u0634\u062f.<\/p>\n<h2 style=\"text-align: justify;\"><span style=\"color: #3366ff;\">Doctest \u062f\u0631 \u0641\u0627\u06cc\u0644\u200c\u0647\u0627\u06cc \u0628\u0631\u0646\u0627\u0645\u0647 \u0646\u0648\u06cc\u0633\u06cc<\/span><\/h2>\n<p style=\"text-align: justify;\">\u062e\u0628 \u062a\u0627\u06a9\u0646\u0648\u0646 \u0627\u0632 Python interactive terminal \u0628\u0631\u0627\u06cc example \u062e\u0648\u062f \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0631\u062f\u0647\u200c\u0627\u06cc\u062f. \u062d\u0627\u0644 \u0627\u0632 \u06cc\u06a9 \u0641\u0627\u06cc\u0644 \u0628\u0631\u0646\u0627\u0645\u0647\u200c\u0646\u0648\u06cc\u0633\u06cc \u0628\u0631\u0627\u06cc \u0634\u0645\u0627\u0631\u0634 \u062a\u0639\u062f\u0627\u062f \u062d\u0631\u0648\u0641 \u0635\u062f\u0627\u062f\u0627\u0631 \u062f\u0631 \u06cc\u06a9 \u06a9\u0644\u0645\u0647 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u062f.<\/p>\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" data-loaded=\"true\" src=\"https:\/\/parspack.com\/blog\/wp-content\/uploads\/2022\/04\/Doctest-in-Python-1.jpg\" class=\"wp-image-22914 size-full\" alt=\"\u0645\u0627\u0698\u0648\u0644 doctest python \u0628\u0631\u0627\u06cc \u062a\u0633\u062a\" title=\"\u062a\u0633\u062a \u0645\u0627\u0698\u0648\u0644 doctest python\"       width=\"650\" height=\"400\" srcset=\"https:\/\/parspack.com\/blog\/wp-content\/uploads\/2022\/04\/Doctest-in-Python-1.jpg 650w, https:\/\/parspack.com\/blog\/wp-content\/uploads\/2022\/04\/Doctest-in-Python-1-300x185.jpg 300w\" sizes=\"auto, (max-width: 650px) 100vw, 650px\" \/><figcaption class=\"text-subtitle-5 text-gray-9 text-center mt-2\" >\u0645\u0627\u0698\u0648\u0644 doctest python \u0628\u0647 \u0645\u0646\u0638\u0648\u0631 \u062a\u0633\u062a \u0631\u0627\u062d\u062a\u200c\u062a\u0631<\/figcaption><\/figure>\n<p style=\"text-align: justify;\">\u062f\u0631 \u06cc\u06a9 \u0628\u0631\u0646\u0627\u0645\u0647\u060c \u0645\u06cc\u200c\u062a\u0648\u0627\u0646\u06cc\u062f \u0645\u0627\u0698\u0648\u0644 Doctest \u0631\u0627 \u062f\u0631 \u06a9\u0644\u0627\u0648\u0632 if __name__ == &#8220;__main__&#8221;: \u062f\u0631 \u067e\u0627\u06cc\u06cc\u0646 \u0641\u0627\u06cc\u0644\u0650 programming \u0627\u06cc\u0645\u067e\u0648\u0631\u062a \u0648 \u06a9\u0627\u0644 \u06a9\u0646\u06cc\u062f. \u0646\u062e\u0633\u062a \u06cc\u06a9 \u0641\u0627\u06cc\u0644 \u062c\u062f\u06cc\u062f \u2014 counting_vowels.py \u2014 \u0631\u0627 \u062f\u0631 \u062a\u06a9\u0633\u062a \u0627\u062f\u06cc\u062a\u0648\u0631 \u062e\u0648\u062f \u0627\u06cc\u062c\u0627\u062f \u06a9\u0646\u06cc\u062f. \u0645\u06cc\u200c\u062a\u0648\u0627\u0646\u06cc\u062f \u0627\u0632 \u0627\u062f\u06cc\u062a\u0648\u0631 nano \u062f\u0631 command line \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0646\u0645\u0627\u06cc\u06cc\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ nano counting_vowels.py<\/pre>\n<p style=\"text-align: justify;\">\u0645\u06cc\u200c\u062a\u0648\u0627\u0646\u06cc\u062f \u0628\u0627 \u062a\u0639\u0631\u06cc\u0641 \u062a\u0627\u0628\u0639 count_vowels \u0648 \u0627\u0631\u0633\u0627\u0644 \u067e\u0627\u0631\u0627\u0645\u062a\u0631 word \u0628\u0647 \u062a\u0627\u0628\u0639 \u0634\u0631\u0648\u0639 \u06a9\u0646\u06cc\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def count_vowels(word):<\/pre>\n<p style=\"text-align: justify;\">\u0642\u0628\u0644 \u0627\u0632 \u0646\u0648\u0634\u062a\u0646 \u0628\u0627\u062f\u06cc\u0650 \u0641\u0627\u0646\u06a9\u0634\u0646\u060c \u0628\u0647\u062a\u0631 \u0627\u0633\u062a \u062f\u0631\u0628\u0627\u0631\u0647 \u062e\u0648\u0627\u0633\u062a\u0647 \u062e\u0648\u062f \u0627\u0632 \u062a\u0627\u0628\u0639 \u0645\u0648\u0631\u062f \u0646\u0638\u0631 \u062f\u0631 Doctest \u062a\u0648\u0636\u06cc\u062d\u0627\u062a\u06cc \u0627\u0631\u0627\u0626\u0647 \u062f\u0647\u06cc\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def count_vowels(word):\r\n    \"\"\"\r\n    Given a single word, return the total number of vowels in that single word.<\/pre>\n<p style=\"text-align: justify;\">\u0646\u0648\u0639 \u062f\u0627\u062f\u0647 \u0631\u0627 \u0628\u0627 \u067e\u0627\u0631\u0627\u0645\u062a\u0631 word \u0648 \u0646\u0648\u0639 \u062f\u06cc\u062a\u0627\u06cc \u0628\u0631\u06af\u0634\u062a\u06cc \u0631\u0627 \u062f\u0631 \u0648\u062d\u0644\u0647 \u0627\u0648\u0644 \u06cc\u06a9 string \u0648 \u062f\u0631 \u062d\u0627\u0644\u062a \u062f\u0648\u0645 \u0622\u0646 \u0631\u0627 \u06cc\u06a9 integer \u062f\u0631 \u0646\u0638\u0631 \u0645\u06cc\u200c\u06af\u06cc\u0631\u06cc\u0645. \u062f\u0631 \u0648\u0627\u0642\u0639 \u062f\u0631 \u062d\u0627\u0644\u062a \u0627\u0648\u0644 \u06cc\u06a9 \u0631\u0634\u062a\u0647 \u0648 \u062f\u0631 \u062d\u0627\u0644\u062a \u062f\u0648\u0645 \u06cc\u06a9 \u0639\u062f\u062f \u0635\u062d\u06cc\u062d \u0646\u0645\u0627\u06cc\u0634 \u062f\u0627\u062f\u0647 \u0645\u06cc\u200c\u0634\u0648\u062f.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def count_vowels(word):\r\n    \"\"\"\r\n    Given a single word, return the total number of vowels in that single word.\r\n\r\n    :param word: str\r\n    :return: int<\/pre>\n<p style=\"text-align: justify;\">\u0628\u0631\u0627\u06cc \u062f\u0631\u06a9 \u0628\u0647\u062a\u0631 \u0645\u0648\u0636\u0648\u0639 \u0645\u06cc\u200c\u062a\u0648\u0627\u0646\u06cc\u062f \u0645\u062b\u0627\u0644\u06cc \u0631\u0627 \u0627\u0645\u062a\u062d\u0627\u0646 \u06a9\u0646\u06cc\u062f. \u06cc\u06a9 \u06a9\u0644\u0645\u0647 \u0635\u062f\u0627 \u062f\u0627\u0631 \u062f\u0631 \u0646\u0638\u0631 \u0628\u06af\u06cc\u0631\u06cc\u062f \u0648 \u0622\u0646 \u0631\u0627 \u062f\u0631 \u0631\u0634\u062a\u0647 docstring \u062a\u0627\u06cc\u067e \u06a9\u0646\u06cc\u062f.<\/p>\n<p style=\"text-align: justify;\">\u0628\u0631\u0627\u06cc \u0645\u062b\u0627\u0644 \u06a9\u0644\u0645\u0647 &#8216;Cusco&#8217; \u0631\u0627 \u0627\u0646\u062a\u062e\u0627\u0628 \u06a9\u0646\u06cc\u062f. \u062f\u0631 \u0627\u06cc\u0646 \u06a9\u0644\u0645\u0647 \u0686\u0646\u062f \u062d\u0631\u0641 \u0635\u062f\u0627\u062f\u0627\u0631 \u0648\u062c\u0648\u062f \u062f\u0627\u0631\u062f\u061f \u062f\u0631 \u0632\u0628\u0627\u0646 \u0627\u0646\u06af\u0644\u06cc\u0633\u06cc \u062d\u0631\u0648\u0641 \u0635\u062f\u0627\u062f\u0627\u0631 \u0634\u0627\u0645\u0644 a\u060c e\u060c i\u060c o \u0648 u \u0627\u0633\u062a. \u067e\u0633 \u062f\u0631 \u0627\u06cc\u0646 \u0645\u062b\u0627\u0644 \u0634\u0645\u0627 \u062f\u0648 \u062d\u0631\u0641 \u0635\u062f\u0627\u062f\u0627\u0631 o \u0648 u \u0631\u0627 \u062f\u0627\u0631\u06cc\u062f.<\/p>\n<p style=\"text-align: justify;\">\u062d\u0627\u0644 \u062a\u0633\u062a \u0631\u0627 \u0628\u0631\u0627\u06cc \u06a9\u0644\u0645\u0647 Cuso \u0627\u0636\u0627\u0641\u0647 \u0645\u06cc\u200c\u06a9\u0646\u06cc\u0645 \u0648 \u0628\u0631\u06af\u0634\u062a \u0622\u0646 \u06a9\u0647 \u06f2 \u0628\u0639\u0646\u0648\u0627\u0646 \u062a\u0639\u062f\u0627\u062f \u0627\u0639\u062f\u0627\u062f \u0635\u062d\u06cc\u062d \u062f\u0631 \u0628\u0631\u0646\u0627\u0645\u0647 \u0645\u0627 \u0645\u06cc\u200c\u0628\u0627\u0634\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def count_vowels(word):\r\n    \"\"\"\r\n    Given a single word, return the total number of vowels in that single word.\r\n\r\n    :param word: str\r\n    :return: int\r\n\r\n    &gt;&gt;&gt; count_vowels('Cusco')\r\n    2<\/pre>\n<p style=\"text-align: justify;\">\u0628\u0631\u0627\u06cc \u062f\u0631\u06a9 \u0628\u0647\u062a\u0631 \u0645\u0648\u0636\u0648\u0639 \u0645\u062b\u0627\u0644 \u062f\u06cc\u06af\u0631\u06cc \u0628\u0627 \u062a\u0639\u062f\u0627\u062f \u062d\u0631\u0648\u0641 \u0635\u062f\u0627\u062f\u0627\u0631 \u0628\u06cc\u0634\u062a\u0631 \u0645\u0627\u0646\u0646\u062f Manila \u0631\u0627 \u0627\u0645\u062a\u062d\u0627\u0646 \u06a9\u0646\u06cc\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def count_vowels(word):\r\n    \"\"\"\r\n    Given a single word, return the total number of vowels in that single word.\r\n\r\n    :param word: str\r\n    :return: int\r\n\r\n    &gt;&gt;&gt; count_vowels('Cusco')\r\n    2\r\n\r\n    &gt;&gt;&gt; count_vowels('Manila')\r\n    3\r\n    \"\"\"<\/pre>\n<p style=\"text-align: justify;\">\u0627\u06a9\u0646\u0648\u0646 Doctest \u062f\u0631\u0633\u062a \u06a9\u0627\u0631 \u0645\u06cc\u200c\u06a9\u0646\u062f. \u0628\u0646\u0627\u0628\u0631\u0627\u06cc\u0646 \u0645\u06cc\u200c\u062a\u0648\u0627\u0646\u06cc\u062f \u06a9\u062f\u0646\u0648\u06cc\u0633\u06cc program \u062e\u0648\u062f \u0631\u0627 \u0634\u0631\u0648\u0639 \u06a9\u0646\u06cc\u062f.<\/p>\n<p style=\"text-align: justify;\">\u0628\u0627 \u0645\u0642\u062f\u0627\u0631\u062f\u0647\u06cc \u0627\u0648\u0644\u06cc\u0647 \u06cc\u06a9 \u0645\u062a\u063a\u06cc\u0631 \u0634\u0631\u0648\u0639 \u0645\u06cc\u200c\u06a9\u0646\u06cc\u0645: \u0628\u0631\u0627\u06cc \u0646\u06af\u0647\u062f\u0627\u0631\u06cc \u062d\u0631\u0648\u0641 \u0645\u0635\u0648\u062a \u062f\u0631 \u06cc\u06a9 \u06a9\u0644\u0645\u0647 \u0627\u0632 total_vowels \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u062f. \u0627\u06a9\u0646\u0648\u0646 \u062f\u0631 \u0645\u0631\u062d\u0644\u0647 \u0628\u0639\u062f \u062d\u0644\u0642\u0647 for \u0631\u0627 \u0627\u06cc\u062c\u0627\u062f \u06a9\u0646\u06cc\u062f \u062a\u0627 \u062f\u0631 \u0645\u06cc\u0627\u0646\u0650 \u062d\u0631\u0648\u0641\u0650 \u0631\u0634\u062a\u0647\u0654 word \u062a\u06a9\u0631\u0627\u0631 \u0634\u0648\u062f. \u0633\u067e\u0633 \u0627\u0632 \u06cc\u06a9 conditional statement \u0628\u0631\u0627\u06cc \u0628\u0631\u0631\u0633\u06cc \u0645\u0635\u0648\u062a \u0628\u0648\u062f\u0646\u0650 \u062d\u0631\u0648\u0641 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0646\u0645\u0627\u06cc\u06cc\u062f. \u062a\u0639\u062f\u0627\u062f \u062d\u0631\u0648\u0641 \u0635\u062f\u0627\u062f\u0627\u0631 \u062f\u0631 \u062d\u06cc\u0646 \u0627\u062c\u0631\u0627\u06cc \u0644\u0648\u067e \u0628\u0627\u0644\u0627 \u062e\u0648\u0627\u0647\u062f \u0631\u0641\u062a \u0648 \u062f\u0631 \u0646\u0647\u0627\u06cc\u062a \u0639\u062f\u062f \u0622\u062e\u0631 \u0628\u062f\u0633\u062a \u0622\u0645\u062f\u0647 \u0627\u0632 \u0634\u0645\u0627\u0631\u0634 \u062d\u0631\u0648\u0641 \u0635\u062f\u0627\u062f\u0627\u0631\u0650 \u06a9\u0644\u0645\u0647 \u0628\u0647 total_values \u0628\u0631\u06af\u0634\u062a \u062f\u0627\u062f\u0647 \u0645\u06cc\u200c\u0634\u0648\u062f. \u0628\u0646\u0627\u0628\u0631\u0627\u06cc\u0646 \u0628\u0631\u0646\u0627\u0645\u0647 \u0645\u0634\u0627\u0628\u0647 \u0633\u0627\u062e\u062a\u0627\u0631 \u0627\u0631\u0627\u0626\u0647 \u0634\u062f\u0647 \u0628\u062f\u0648\u0646 \u062f\u0627\u06a9\u062a\u0633\u062a \u0628\u0635\u0648\u0631\u062a \u0632\u06cc\u0631 \u0645\u06cc\u200c\u0628\u0627\u0634\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def count_vowels(word):\r\n    total_vowels = 0\r\n    for letter in word:\r\n        if letter in 'aeiou':\r\n            total_vowels += 1\r\n    return total_vowels<\/pre>\n<p style=\"text-align: justify;\">\u0627\u06a9\u0646\u0648\u0646 \u062f\u0631 \u067e\u0627\u06cc\u06cc\u0646 \u06a9\u062f\u0646\u0648\u06cc\u0633\u06cc \u06a9\u0644\u0627\u0648\u0632 main \u062e\u0648\u062f \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0631\u062f\u0647 \u0648 \u0645\u0627\u0698\u0648\u0644 \u062f\u0627\u06a9\u200c\u062a\u0633\u062a \u0631\u0627 \u0627\u062c\u0631\u0627 \u06a9\u0646\u06cc\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">if __name__ == \"__main__\":\r\n    import doctest\r\n    doctest.testmod()<\/pre>\n<p style=\"text-align: justify;\">\u062f\u0631 \u0646\u0647\u0627\u06cc\u062a \u0628\u0631\u0646\u0627\u0645\u0647 \u0628\u0647\u200c\u0635\u0648\u0631\u062a \u0632\u06cc\u0631 \u0645\u06cc\u200c\u0628\u0627\u0634\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def count_vowels(word):\r\n    \"\"\"\r\n    Given a single word, return the total number of vowels in that single word.\r\n\r\n    :param word: str\r\n    :return: int\r\n\r\n    &gt;&gt;&gt; count_vowels('Cusco')\r\n    2\r\n\r\n    &gt;&gt;&gt; count_vowels('Manila')\r\n    3\r\n    \"\"\"\r\n    total_vowels = 0\r\n    for letter in word:\r\n        if letter in 'aeiou':\r\n            total_vowels += 1\r\n    return total_vowels\r\n\r\nif __name__ == \"__main__\":\r\n    import doctest\r\n    doctest.testmod()<\/pre>\n<p style=\"text-align: justify;\">\u0634\u0645\u0627 \u0645\u06cc\u200c\u062a\u0648\u0627\u0646\u06cc\u062f \u0627\u06cc\u0646 \u0628\u0631\u0646\u0627\u0645\u0647 \u0631\u0627 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u06a9\u0627\u0645\u0646\u062f\u0650 python \u06cc\u0627 python3(\u0628\u0633\u062a\u0647 \u0628\u0647 \u0645\u0646\u0627\u0628\u0639 \u0645\u062c\u0627\u0632\u06cc \u0634\u0645\u0627 \u062f\u0627\u0631\u062f) \u0627\u062c\u0631\u0627 \u06a9\u0646\u06cc\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">python counting_vowels.py<\/pre>\n<p style=\"text-align: justify;\">\u0627\u06af\u0631 \u062a\u0645\u0627\u0645 program \u0634\u0645\u0627 \u0645\u0627\u0646\u0646\u062f \u0628\u0627\u0644\u0627 \u0646\u0648\u0634\u062a\u0647 \u0634\u062f\u0647 \u0628\u0627\u0634\u062f\u060c \u062a\u0645\u0627\u0645\u06cc \u062a\u0633\u062a \u0647\u0627 \u0628\u0627\u06cc\u062f \u0645\u0648\u0641\u0642\u062a\u200c\u0622\u0645\u06cc\u0632 \u06af\u0630\u0631\u0627\u0646\u062f\u0647 \u0634\u0648\u0646\u062f \u0648 output\u0627\u06cc \u0631\u0627 \u062f\u0631\u06cc\u0627\u0641\u062a \u0646\u0645\u06cc\u200c\u06a9\u0646\u06cc\u062f. \u0627\u06cc\u0646 \u0628\u062f\u0627\u0646 \u0645\u0639\u0646\u0627\u0633\u062a \u06a9\u0647 \u062a\u0633\u062a\u200c\u0647\u0627 \u0631\u0627 \u067e\u0627\u0633 \u06a9\u0631\u062f\u0647\u200c\u0627\u06cc\u062f. \u0627\u06cc\u0646 \u0648\u06cc\u0698\u06af\u06cc \u0628\u0631\u0627\u06cc \u0627\u062c\u0631\u0627\u06cc \u0628\u0631\u0646\u0627\u0645\u0647 \u0628\u0627 \u0627\u0647\u062f\u0627\u0641 \u062f\u06cc\u06af\u0631 \u0645\u0641\u06cc\u062f \u0648\u0627\u0642\u0639 \u0645\u06cc\u200c\u0634\u0648\u062f. \u0627\u06af\u0631 \u062a\u0633\u062a \u0631\u0627 \u062e\u0635\u0648\u0635\u0627 \u0628\u0631\u0627\u06cc \u062f\u06cc\u062f\u0646 \u0646\u062a\u06cc\u062c\u0647 \u0627\u062c\u0631\u0627 \u0645\u06cc\u200c\u06a9\u0646\u06cc\u062f\u060c \u0645\u06cc\u200c\u062a\u0648\u0627\u0646\u06cc\u062f \u0627\u0632 \u0641\u0644\u06af\u0650 v- \u0628\u0635\u0648\u0631\u062a \u0632\u06cc\u0631 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0646\u0645\u0627\u06cc\u06cc\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">python counting_vowels.py -v<\/pre>\n<p style=\"text-align: justify;\">\u062f\u0631 \u0646\u0647\u0627\u06cc\u062a \u0628\u0627 \u0627\u062c\u0631\u0627\u06cc \u0628\u0631\u0646\u0627\u0645\u0647 \u0634\u0645\u0627 \u062e\u0631\u0648\u062c\u06cc \u0632\u06cc\u0631 \u0631\u0627 \u062f\u0631\u06cc\u0627\u0641\u062a \u062e\u0648\u0627\u0647\u06cc\u062f \u06a9\u0631\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Trying:\r\n    count_vowels('Cusco')\r\nExpecting:\r\n    2\r\nok\r\nTrying:\r\n    count_vowels('Manila')\r\nExpecting:\r\n    3\r\nok\r\n1 items had no tests:\r\n    __main__\r\n1 items passed all tests:\r\n   2 tests in __main__.count_vowels\r\n2 tests in 2 items.\r\n2 passed and 0 failed.\r\nTest passed.<\/pre>\n<p style=\"text-align: justify;\">\u062a\u0627 \u0628\u062f\u06cc\u0646 \u0644\u062d\u0638\u0647 \u062a\u0648\u0627\u0646\u0633\u062a\u0647\u200c\u0627\u06cc\u062f \u062a\u0633\u062a \u0631\u0627 \u0628\u0627 \u0645\u0648\u0641\u0642\u06cc\u062a \u067e\u0634\u062a \u0633\u0631 \u0628\u06af\u0630\u0627\u0631\u06cc\u062f. \u0628\u0627 \u0627\u06cc\u0646 \u062d\u0627\u0644\u060c \u06a9\u062f\u0647\u0627\u06cc \u0628\u0631\u0646\u0627\u0645\u0647 \u0634\u0627\u06cc\u062f \u0628\u0631\u0627\u06cc \u062d\u0627\u0644\u062a\u200c\u0647\u0627\u06cc \u062e\u0627\u0635 \u0628\u0647\u06cc\u0646\u0647 \u0646\u0634\u062f\u0647 \u0628\u0627\u0634\u0646\u062f. \u062f\u0631 \u0627\u062f\u0627\u0645\u0647 \u06cc\u0627\u062f \u062e\u0648\u0627\u0647\u06cc\u0645 \u06af\u0631\u0641\u062a \u0686\u0637\u0648\u0631 \u0627\u0632 Doctest\u200c\u0647\u0627 \u0628\u0631\u0627\u06cc \u0628\u0647\u062a\u0631 \u0633\u0627\u062e\u062a\u0646 \u06a9\u062f \u0647\u0627\u06cc\u0645\u0627\u0646 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u0645.<\/p>\n<h2 style=\"text-align: justify;\"><span style=\"color: #3366ff;\">\u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 Doctest \u0628\u0631\u0627\u06cc \u0628\u0647\u0628\u0648\u062f \u0648 \u062a\u0642\u0648\u06cc\u062a \u06cc\u06a9 \u06a9\u062f<\/span><\/h2>\n<p style=\"text-align: justify;\">\u062a\u0627 \u0627\u06cc\u0646\u062c\u0627 \u06cc\u06a9 \u0628\u0631\u0646\u0627\u0645\u0647 \u062f\u0627\u0631\u06cc\u0645 \u06a9\u0647 \u06a9\u0627\u0631 \u0645\u06cc\u200c\u06a9\u0646\u062f. \u0627\u0645\u0627 \u0634\u0627\u06cc\u062f \u0628\u0647\u062a\u0631\u06cc\u0646 \u0628\u0631\u0646\u0627\u0645\u0647 \u0645\u0648\u062c\u0648\u062f \u0646\u0628\u0627\u0634\u062f. \u0628\u0646\u0627\u0628\u0631\u0627\u06cc\u0646 \u062f\u0631 \u0627\u06cc\u0646 \u0645\u0631\u062d\u0644\u0647 \u0633\u0639\u06cc \u062e\u0648\u0627\u0647\u06cc\u0645 \u06a9\u0631\u062f \u062a\u0627 \u0646\u0642\u0635\u0627\u0646\u200c\u0647\u0627\u06cc \u062c\u0632\u0626\u06cc \u0622\u0646 \u0631\u0627 \u0628\u0631\u0637\u0631\u0641 \u06a9\u0646\u06cc\u0645. \u0628\u0637\u0648\u0631 \u0645\u062b\u0627\u0644\u060c \u0622\u06cc\u0627 \u0628\u0647 \u0627\u06cc\u0646 \u0645\u0648\u0636\u0648\u0639 \u0641\u06a9\u0631 \u06a9\u0631\u062f\u0647\u200c\u0627\u06cc\u062f \u06a9\u0647 \u0627\u06af\u0631 \u062d\u0631\u0641 \u0635\u062f\u0627\u062f\u0627\u0631\u06cc \u0628\u0627 \u0641\u0631\u0645 \u06a9\u067e\u06cc\u062a\u0627\u0644 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u0645 \u0686\u0647 \u0627\u062a\u0641\u0627\u0642\u06cc \u0645\u06cc\u200c\u0627\u0641\u062a\u062f\u061f\u200d!<\/p>\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" data-loaded=\"true\" src=\"https:\/\/parspack.com\/blog\/wp-content\/uploads\/2022\/04\/Doctest-in-Python.jpg\" class=\"wp-image-22913 size-full\" alt=\"\u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 doctests \u062f\u0631 \u067e\u0627\u06cc\u062a\u0648\u0646 \" title=\"\u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 doctests \u062f\u0631 \u067e\u0627\u06cc\u062a\u0648\u0646\u00a0\"       width=\"650\" height=\"400\" srcset=\"https:\/\/parspack.com\/blog\/wp-content\/uploads\/2022\/04\/Doctest-in-Python.jpg 650w, https:\/\/parspack.com\/blog\/wp-content\/uploads\/2022\/04\/Doctest-in-Python-300x185.jpg 300w\" sizes=\"auto, (max-width: 650px) 100vw, 650px\" \/><figcaption class=\"text-subtitle-5 text-gray-9 text-center mt-2\" >\u0645\u062b\u0627\u0644 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 doctests \u062f\u0631 \u067e\u0627\u06cc\u062a\u0648\u0646\u00a0<\/figcaption><\/figure>\n<p style=\"text-align: justify;\">\u062f\u0631 \u0646\u062a\u06cc\u062c\u0647 \u0645\u062b\u0627\u0644\u06cc \u062f\u06cc\u06af\u0631 \u062f\u0631 Doctest \u0648\u0627\u0631\u062f \u0645\u06cc\u200c\u06a9\u0646\u06cc\u0645. \u0627\u06cc\u0646\u0628\u0627\u0631 \u06a9\u0644\u0645\u0647 &#8216;Istanbul&#8217; \u0631\u0627 \u062f\u0631 \u0646\u0638\u0631 \u0628\u06af\u06cc\u0631\u06cc\u062f. \u0645\u0627\u0646\u0646\u062f Manila\u060c \u0627\u0633\u062a\u0627\u0645\u0628\u0648\u0644 \u0647\u0645 \u062f\u0627\u0631\u0627\u06cc \u0633\u0647 \u062d\u0631\u0641 \u0635\u062f\u0627\u062f\u0627\u0631 \u0627\u0633\u062a.<br \/>\n\u062f\u0631 \u0627\u06cc\u0646\u062c\u0627 \u0628\u0631\u0646\u0627\u0645\u0647 \u0622\u067e\u062f\u06cc\u062a \u0634\u062f\u0647 \u0628\u0627 \u0645\u062b\u0627\u0644 \u062c\u062f\u06cc\u062f \u0631\u0627 \u0645\u06cc\u200c\u0628\u06cc\u0646\u06cc\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def count_vowels(word):\r\n    \"\"\"\r\n    Given a single word, return the total number of vowels in that single word.\r\n\r\n    :param word: str\r\n    :return: int\r\n\r\n    &gt;&gt;&gt; count_vowels('Cusco')\r\n    2\r\n\r\n    &gt;&gt;&gt; count_vowels('Manila')\r\n    3\r\n\r\n    &gt;&gt;&gt; count_vowels('Istanbul')\r\n    3\r\n    \"\"\"\r\n    total_vowels = 0\r\n    for letter in word:\r\n        if letter in 'aeiou':\r\n            total_vowels += 1\r\n    return total_vowels\r\n\r\nif __name__ == \"__main__\":\r\n    import doctest\r\n    doctest.testmod()<\/pre>\n<p style=\"text-align: justify;\">\u0627\u06a9\u0646\u0648\u0646 \u062f\u0648\u0628\u0627\u0631\u0647 \u0628\u0631\u0646\u0627\u0645\u0647 \u0631\u0627 \u0627\u062c\u0631\u0627 \u06a9\u0646\u06cc\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">$ python counting_vowels.py<\/pre>\n<p style=\"text-align: justify;\">\u062f\u0631 \u0627\u06cc\u0646 \u0645\u0631\u062d\u0644\u0647 \u0628\u0627\u06af \u0631\u06cc\u0632\u06cc \u06a9\u0647 \u062f\u0646\u0628\u0627\u0644 \u0622\u0646 \u0628\u0648\u062f\u0647\u200c\u0627\u06cc\u0645 \u0631\u0627 \u067e\u06cc\u062f\u0627 \u06a9\u0631\u062f\u0647\u200c\u0627\u06cc\u0645! \u0628\u0639\u0628\u0627\u0631\u062a\u06cc \u0633\u0627\u062f\u0647\u200c\u062a\u0631\u060c \u067e\u0633 \u0627\u0632 \u0627\u062c\u0631\u0627 \u062e\u0631\u0648\u062c\u06cc \u0632\u06cc\u0631 \u0631\u0627 \u062f\u0631\u06cc\u0627\u0641\u062a \u062e\u0648\u0627\u0647\u06cc\u062f \u06a9\u0631\u062f:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">**********************************************************************\r\nFile \"counting_vowels.py\", line 14, in __main__.count_vowels\r\nFailed example:\r\n    count_vowels('Istanbul')\r\nExpected:\r\n    3\r\nGot:\r\n    2\r\n**********************************************************************\r\n1 items had failures:\r\n   1 of   3 in __main__.count_vowels\r\n***Test Failed*** 1 failures.<\/pre>\n<p style=\"text-align: justify;\">\u062e\u0631\u0648\u062c\u06cc \u0628\u0627\u0644\u0627 \u0646\u0634\u0627\u0646 \u0645\u06cc\u200c\u062f\u0647\u062f \u06a9\u0647 \u0628\u0631\u0646\u0627\u0645\u0647 \u0634\u0645\u0627 \u0628\u0627 \u062e\u0637\u0627 \u0631\u0648\u0628\u0631\u0648 \u0634\u062f\u0647 \u0627\u0633\u062a. \u0634\u0645\u0627 \u0627\u0646\u062a\u0638\u0627\u0631 \u062f\u0627\u0634\u062a\u06cc\u062f \u06a9\u0647 3 \u062d\u0631\u0641 \u0645\u0635\u0648\u062a \u0631\u0627 \u0646\u0634\u0627\u0646 \u062f\u0647\u062f\u060c \u062f\u0631 \u062d\u0627\u0644\u06cc \u06a9\u0647 \u062a\u0646\u0647\u0627 2 \u062d\u0631\u0641 \u0645\u0635\u0648\u062a \u0631\u0627 \u0634\u0646\u0627\u0633\u0627\u06cc\u06cc \u06a9\u0631\u062f\u0647 \u0627\u0633\u062a. \u0627\u0645\u0627 \u062f\u0644\u06cc\u0644 \u0627\u06cc\u0646 \u062e\u0637\u0627 \u0686\u06cc\u0633\u062a\u061f<\/p>\n<p style=\"text-align: justify;\">\u062f\u0644\u06cc\u0644 \u062e\u0637\u0627 \u0627\u06cc\u0646 \u0627\u0633\u062a \u06a9\u0647 \u062f\u0631 \u0639\u0628\u0627\u0631\u062a \u0634\u0631\u0637\u06cc\u0650 if letter in &#8216;aeiou&#8217;: \u0634\u0645\u0627 \u062d\u0631\u0648\u0641 \u0645\u0635\u0648\u062a \u0631\u0627 \u0628\u0635\u0648\u0631\u062a \u06a9\u0648\u0686\u06a9 \u0622\u0646\u0647\u0627 \u062a\u0639\u0631\u06cc\u0641 \u06a9\u0631\u062f\u0647\u200c\u0627\u06cc\u062f \u0648 \u0628\u0631\u0646\u0627\u0645\u0647 \u0642\u0627\u062f\u0631 \u0628\u0647 \u0634\u0646\u0627\u0633\u0627\u06cc\u06cc \u062d\u0631\u0648\u0641 \u0628\u0632\u0631\u06af \u0646\u06cc\u0633\u062a.<\/p>\n<p style=\"text-align: justify;\">\u0628\u0631\u0627\u06cc \u0631\u0641\u0639 \u0627\u06cc\u0646 \u0645\u0634\u06a9\u0644 \u0645\u06cc\u200c\u062a\u0648\u0627\u0646\u06cc\u062f \u062d\u0631\u0648\u0641 \u0645\u0635\u0648\u062a \u0631\u0627 \u0628\u0635\u0648\u0631\u062a AEIOUaeiou&#8217; \u062a\u0639\u0631\u06cc\u0641 \u06a9\u0646\u06cc\u062f \u06cc\u0627 \u0645\u06cc\u200c\u062a\u0648\u0627\u0646\u06cc\u062f word \u0631\u0627 \u0628\u0647 word.lower() \u062a\u063a\u06cc\u06cc\u0631 \u062f\u0647\u06cc\u062f \u062a\u0627 \u062f\u0631 \u0635\u0648\u0631\u062a \u0648\u062c\u0648\u062f \u0647\u0631 \u062d\u0631\u0641 \u0628\u0632\u0631\u06af \u0622\u0646 \u0631\u0627 \u0628\u0647 \u062d\u0631\u0641 \u06a9\u0648\u0686\u06a9 \u0648 \u062a\u0628\u062f\u06cc\u0644 \u06a9\u0646\u062f \u0648 \u0628\u062f\u06cc\u0646 \u062a\u0631\u062a\u06cc\u0628 \u0622\u0646 \u0631\u0627 \u0647\u0645 \u062c\u0632 \u0634\u0645\u0627\u0631\u0634 \u062e\u0648\u062f \u062d\u0633\u0627\u0628 \u06a9\u0646\u062f.:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">def count_vowels(word):\r\n    \"\"\"\r\n    Given a single word, return the total number of vowels in that single word.\r\n\r\n    :param word: str\r\n    :return: int\r\n\r\n    &gt;&gt;&gt; count_vowels('Cusco')\r\n    2\r\n\r\n    &gt;&gt;&gt; count_vowels('Manila')\r\n    3\r\n\r\n    &gt;&gt;&gt; count_vowels('Istanbul')\r\n    3\r\n    \"\"\"\r\n    total_vowels = 0\r\n    for letter in word.lower():\r\n        if letter in 'aeiou':\r\n            total_vowels += 1\r\n    return total_vowels\r\n\r\nif __name__ == \"__main__\":\r\n    import doctest\r\n    doctest.testmod()<\/pre>\n<p style=\"text-align: justify;\">\u062f\u0631 \u0646\u0647\u0627\u06cc\u062a \u0628\u0631\u0646\u0627\u0645\u0647 \u0631\u0627 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 python counting_vowels.py -v \u0648 verbose flag \u0627\u062c\u0631\u0627 \u06a9\u0646\u06cc\u062f. \u0645\u0645\u06a9\u0646 \u0627\u0633\u062a \u0627\u06cc\u0646 \u0628\u0631\u0646\u0627\u0645\u0647\u060c \u0628\u0647\u062a\u0631\u06cc\u0646 \u0628\u0631\u0646\u0627\u0645\u0647 \u0645\u0645\u06a9\u0646 \u0646\u0628\u0627\u0634\u062f \u0648 \u067e\u0633 \u0627\u0632 \u0627\u062c\u0631\u0627 \u062e\u0637\u0627\u0647\u0627\u06cc\u06cc \u062f\u0631 \u0622\u0646 \u0638\u0627\u0647\u0631 \u0634\u0648\u062f.<\/p>\n<p style=\"text-align: justify;\">\u0628\u0631\u0627\u06cc \u0645\u062b\u0627\u0644 \u0627\u06af\u0631 \u06a9\u0644\u0645\u0647 &#8216;Sydney&#8217; \u0631\u0627 \u062f\u0631 \u0646\u0638\u0631 \u0628\u06af\u06cc\u0631\u06cc\u062f. \u062f\u0631 \u0632\u0628\u0627\u0646 \u0627\u0646\u06af\u0644\u06cc\u0633\u06cc \u06af\u0627\u0647\u06cc \u062d\u0631\u0641 Y \u0628\u0647 \u0639\u0646\u0648\u0627\u0646 \u062d\u0631\u0648\u0641 \u0635\u062f\u0627\u062f\u0627\u0631 \u062f\u0631 \u0646\u0638\u0631 \u06af\u0631\u0641\u062a\u0647 \u0645\u06cc\u200c\u0634\u0648\u062f. \u06cc\u0627 \u0628\u0631\u0627\u06cc \u0645\u062b\u0627\u0644 \u0627\u06af\u0631 \u06a9\u0644\u0645\u0647 &#8216;W\u00fcrzburg&#8217; \u0631\u0627 \u062f\u0631 \u0646\u0638\u0631 \u0628\u06af\u06cc\u0631\u06cc\u062f\u060c \u062d\u0631\u0641 &#8216;\u00fc&#8217; \u0631\u0627 \u062f\u0631 \u0627\u0646\u06af\u0644\u06cc\u0633\u06cc \u0686\u06af\u0648\u0646\u0647 \u0627\u0633\u062a\u061f \u0627\u06cc\u0646 \u06a9\u0644\u0645\u0627\u062a \u0631\u0627 \u0628\u0627\u06cc\u062f \u0628\u0647 \u0686\u0647 \u0635\u0648\u0631\u062a\u06cc \u062f\u0631 \u0646\u0638\u0631 \u06af\u0631\u0641\u062a\u061f \u0627\u0632 \u0686\u0647 \u06a9\u062f \u06cc\u0627 \u062f\u0633\u062a\u0648\u0631\u0627\u062a\u06cc \u0628\u0631\u0627\u06cc \u0627\u06cc\u0646 \u06a9\u0644\u0645\u0627\u062a \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u062e\u0648\u0627\u0647\u06cc\u062f \u06a9\u0631\u062f\u061f<\/p>\n<p style=\"text-align: justify;\">\u0628\u0647 \u0639\u0646\u0648\u0627\u0646 \u06cc\u06a9 \u0628\u0631\u0646\u0627\u0645\u0647\u200c\u0646\u0648\u06cc\u0633 \u06af\u0627\u0647\u06cc \u0627\u0648\u0642\u0627\u062a \u0628\u0627\u06cc\u062f \u062a\u0635\u0645\u06cc\u0645\u200c\u0647\u0627\u06cc \u067e\u06cc\u0686\u06cc\u062f\u0647\u200c\u0627\u06cc \u0631\u0627 \u0628\u06af\u06cc\u0631\u06cc\u062f. \u062f\u0631 \u0628\u0633\u06cc\u0627\u0631\u06cc \u0627\u0632 \u0645\u0648\u0627\u0631\u062f \u0634\u0645\u0627 \u062f\u0627\u0645\u0646\u0647 \u06a9\u0627\u0645\u0644 \u0627\u062d\u062a\u0645\u0627\u0644\u0627\u062a \u0631\u0627 \u062f\u0631 \u0646\u0638\u0631 \u0646\u062e\u0648\u0627\u0647\u06cc\u062f \u06af\u0631\u0641\u062a. \u0628\u0647 \u0647\u0645\u06cc\u0646 \u0645\u0646\u0638\u0648\u0631 \u0645\u0627\u0698\u0648\u0644 Doctest \u0627\u0628\u0632\u0627\u0631 \u062e\u0648\u0628\u06cc \u0628\u0631\u0627\u06cc \u0634\u0631\u0648\u0639 \u0628\u0647 \u0641\u06a9\u0631 \u062f\u0631 \u0645\u0648\u0631\u062f \u0645\u0648\u0627\u0631\u062f \u062e\u0627\u0635 \u0648 \u062b\u0628\u062a documentation \u0627\u0648\u0644\u06cc\u0647 \u0645\u06cc\u200c\u0628\u0627\u0634\u062f. \u0627\u0645\u0627 \u062f\u0631 \u0646\u0647\u0627\u06cc\u062a \u0628\u0631\u0627\u06cc \u0633\u0627\u062e\u062a\u0646 \u0628\u0631\u0646\u0627\u0645\u0647\u200c\u0647\u0627\u06cc \u0642\u0648\u06cc \u0628\u0647 \u062a\u0633\u062a\u200c\u0647\u0627\u06cc \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u06a9\u0627\u0631\u0628\u0631 \u0627\u0646\u0633\u0627\u0646\u06cc \u0646\u06cc\u0627\u0632 \u062f\u0627\u0631\u06cc\u062f.<\/p>\n<h2 style=\"text-align: justify;\"><span style=\"color: #3366ff;\">\u062c\u0645\u0639 \u0628\u0646\u062f\u06cc<\/span><\/h2>\n<p style=\"text-align: justify;\">\u0645\u0627\u0698\u0648\u0644 Doctest \u0646\u0647 \u062a\u0646\u0647\u0627 \u0631\u0648\u0634\u06cc \u0628\u0631\u0627\u06cc \u062a\u0633\u062a \u0648 \u062f\u0627\u06a9\u06cc\u0648\u0645\u0646\u062a \u0646\u0648\u06cc\u0633\u06cc\u0650 \u0646\u0631\u0645 \u0627\u0641\u0632\u0627\u0631 \u0627\u0633\u062a\u060c \u0628\u0644\u06a9\u0647 \u0631\u0648\u0634\u06cc \u0628\u0631\u0627\u06cc \u0641\u06a9\u0631 \u06a9\u0631\u062f\u0646 \u062f\u0631\u0628\u0627\u0631\u0647 \u06a9\u062f\u0646\u0648\u06cc\u0633\u06cc\u060c \u0646\u062d\u0648\u0647 \u0634\u0631\u0648\u0639 \u0622\u0646\u060c \u0645\u0633\u062a\u0646\u062f\u0633\u0627\u0632\u06cc\u060c \u062a\u0633\u062a \u0648 \u0646\u0648\u0634\u062a\u0646 \u06a9\u062f \u0628\u0647 \u0634\u0645\u0627\u0631 \u0645\u06cc\u200c\u0622\u06cc\u062f. \u062f\u0631 \u062d\u0642\u06cc\u0642\u062a \u062a\u0633\u062a \u0646\u06a9\u0631\u062f\u0646 \u06a9\u062f\u0647\u0627 \u0646\u0647 \u062a\u0646\u0647\u0627 \u0645\u0646\u062c\u0631 \u0628\u0647 \u0628\u0627\u06af \u0645\u06cc\u200c\u0634\u0648\u062f\u060c \u0628\u0644\u06a9\u0647 \u0628\u0627\u0639\u062b \u062e\u0631\u0627\u0628\u06cc \u0646\u0631\u0645\u200c\u0627\u0641\u0632\u0627\u0631 \u0646\u06cc\u0632 \u062e\u0648\u0627\u0647\u062f \u0634\u0648\u062f.<\/p>\n<h2 style=\"text-align: justify;\"><span style=\"color: #3366ff;\">\u0633\u0648\u0627\u0644\u0627\u062a \u0645\u062a\u062f\u0627\u0648\u0644<\/span><\/h2>\n<h3 style=\"text-align: justify;\"><span style=\"color: #0000ff;\">1. \u0686\u06af\u0648\u0646\u0647 \u0627\u0632 Doctest \u062f\u0631 \u067e\u0627\u06cc\u062a\u0648\u0646 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u0645\u061f<\/span><\/h3>\n<p style=\"text-align: justify;\">\u0633\u0627\u062f\u0647 \u062a\u0631\u06cc\u0646 \u0631\u0627\u0647 \u0628\u0631\u0627\u06cc \u0634\u0631\u0648\u0639 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 doctest \u0627\u06cc\u0646 \u0627\u0633\u062a \u06a9\u0647 \u062f\u0631 \u0647\u0631 \u0645\u0627\u0698\u0648\u0644 M \u0627\u0632 \u06a9\u062f \u0632\u06cc\u0631 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u062f:<\/p>\n<ul>\n<li style=\"text-align: justify;\">if __name__ == &#8220;__main__&#8221;: import doctest doctest. testmod()<\/li>\n<li style=\"text-align: justify;\">python M. py.<\/li>\n<li style=\"text-align: justify;\">python M. py -v.<\/li>\n<li style=\"text-align: justify;\">python -m doctest -v example. py.<\/li>\n<\/ul>\n<h3 style=\"text-align: justify;\"><span style=\"color: #0000ff;\">2. \u0631\u0648\u0634 \u0635\u062d\u06cc\u062d \u0646\u0648\u0634\u062a\u0646 Doctest \u062f\u0631 \u067e\u0627\u06cc\u062a\u0648\u0646 \u0686\u06cc\u0633\u062a\u061f<\/span><\/h3>\n<ol>\n<li style=\"text-align: justify;\">\u062a\u0633\u062a \u062f\u0631 \u067e\u0627\u06cc\u062a\u0648\u0646 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0645\u0627\u0698\u0648\u0644 Doctest \u0628\u0647 \u0635\u0648\u0631\u062a \u0632\u06cc\u0631 \u0627\u0633\u062a:<\/li>\n<li style=\"text-align: justify;\">\u0645\u0627\u0698\u0648\u0644 Doctest \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f.<\/li>\n<li style=\"text-align: justify;\">\u062a\u0627\u0628\u0639 \u0631\u0627 \u0628\u0627 docstring \u0628\u0646\u0648\u06cc\u0633\u06cc\u062f. \u062f\u0631 \u062f\u0627\u062e\u0644 Docstring \u062f\u0648 \u062e\u0637 \u0632\u06cc\u0631 \u0631\u0627 \u0628\u0631\u0627\u06cc \u0622\u0632\u0645\u0627\u06cc\u0634 \u0647\u0645\u0627\u0646 \u062a\u0627\u0628\u0639 \u0628\u0646\u0648\u06cc\u0633\u06cc\u062f. &gt;&gt;&gt;&#8230;<\/li>\n<li style=\"text-align: justify;\">\u06a9\u062f \u062a\u0627\u0628\u0639 \u0631\u0627 \u0628\u0646\u0648\u06cc\u0633\u06cc\u062f.<\/li>\n<li style=\"text-align: justify;\">\u062d\u0627\u0644\u0627 \u0628\u0627 Doctest \u0631\u0627 \u0641\u0631\u0627\u062e\u0648\u0627\u0646\u06cc \u06a9\u0646\u06cc\u062f. \u062a\u0627\u0628\u0639 testmod(name=function_name\u060c verbose=True) \u0628\u0631\u0627\u06cc \u0622\u0632\u0645\u0627\u06cc\u0634.<\/li>\n<\/ol>\n<p><script type=\"application\/ld+json\">\n{\n  \"@context\": \"https:\/\/schema.org\",\n  \"@type\": \"FAQPage\",\n  \"mainEntity\": [{\n    \"@type\": \"Question\",\n    \"name\": \"\u0686\u06af\u0648\u0646\u0647 \u0627\u0632 Doctest \u062f\u0631 \u067e\u0627\u06cc\u062a\u0648\u0646 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u0645\u061f\",\n    \"acceptedAnswer\": {\n      \"@type\": \"Answer\",\n      \"text\": \"\u0633\u0627\u062f\u0647 \u062a\u0631\u06cc\u0646 \u0631\u0627\u0647 \u0628\u0631\u0627\u06cc \u0634\u0631\u0648\u0639 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 doctest \u0627\u06cc\u0646 \u0627\u0633\u062a \u06a9\u0647 \u062f\u0631 \u0647\u0631 \u0645\u0627\u0698\u0648\u0644 M \u0627\u0632 \u06a9\u062f \u0632\u06cc\u0631 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u06a9\u0646\u06cc\u062f:<\/p>\n<p>if __name__ == \\\"__main__\\\": import doctest doctest. testmod()\npython M. py.\npython M. py -v.\npython -m doctest -v example. py.\"\n    }\n  },{\n    \"@type\": \"Question\",\n    \"name\": \"\u0631\u0648\u0634 \u0635\u062d\u06cc\u062d \u0646\u0648\u0634\u062a\u0646 Doctest \u062f\u0631 \u067e\u0627\u06cc\u062a\u0648\u0646 \u0686\u06cc\u0633\u062a\u061f\",\n    \"acceptedAnswer\": {\n      \"@type\": \"Answer\",\n      \"text\": \"\u062a\u0633\u062a \u062f\u0631 \u067e\u0627\u06cc\u062a\u0648\u0646 \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 \u0645\u0627\u0698\u0648\u0644 Doctest \u0628\u0647 \u0635\u0648\u0631\u062a \u0632\u06cc\u0631 \u0627\u0633\u062a:\n\u0645\u0627\u0698\u0648\u0644 Doctest \u0631\u0627 \u0648\u0627\u0631\u062f \u06a9\u0646\u06cc\u062f.\n\u062a\u0627\u0628\u0639 \u0631\u0627 \u0628\u0627 docstring \u0628\u0646\u0648\u06cc\u0633\u06cc\u062f. \u062f\u0631 \u062f\u0627\u062e\u0644 Docstring \u062f\u0648 \u062e\u0637 \u0632\u06cc\u0631 \u0631\u0627 \u0628\u0631\u0627\u06cc \u0622\u0632\u0645\u0627\u06cc\u0634 \u0647\u0645\u0627\u0646 \u062a\u0627\u0628\u0639 \u0628\u0646\u0648\u06cc\u0633\u06cc\u062f. >>>...\n\u06a9\u062f \u062a\u0627\u0628\u0639 \u0631\u0627 \u0628\u0646\u0648\u06cc\u0633\u06cc\u062f.\n\u062d\u0627\u0644\u0627 \u0628\u0627 Doctest \u0631\u0627 \u0641\u0631\u0627\u062e\u0648\u0627\u0646\u06cc \u06a9\u0646\u06cc\u062f. \u062a\u0627\u0628\u0639 testmod(name=function_name\u060c verbose=True) \u0628\u0631\u0627\u06cc \u0622\u0632\u0645\u0627\u06cc\u0634.\"\n    }\n  }]\n}\n<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0645\u0627\u0698\u0648\u0644 doctests \u062f\u0631 \u067e\u0627\u06cc\u062a\u0648\u0646 \u0628\u0647 \u062c\u0647\u062a \u0633\u0647\u0648\u0644\u062a \u062f\u0631 \u0645\u0633\u062a\u0646\u062f\u0633\u0627\u0632\u06cc \u0648 \u062a\u0633\u062a \u0645\u0648\u0631\u062f \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0642\u0631\u0627\u0631 \u0645\u06cc \u06af\u06cc\u0631\u062f. \u062f\u0631 \u0627\u06cc\u0646 \u0645\u0642\u0627\u0644\u0647 \u0646\u0648\u0634\u062a\u0646 doctests \u0648 \u0627\u0646\u062c\u0627\u0645 \u062a\u0633\u062a \u0628\u0627 \u0622\u0646 \u0631\u0627 \u0622\u0645\u0648\u0632\u0634 \u0645\u06cc\u200c\u062f\u0647\u06cc\u0645.<\/p>\n","protected":false},"author":71,"featured_media":35295,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[199],"tags":[],"class_list":["post-22907","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cms"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/parspack.com\/blog\/wp-json\/wp\/v2\/posts\/22907","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/parspack.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/parspack.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/parspack.com\/blog\/wp-json\/wp\/v2\/users\/71"}],"replies":[{"embeddable":true,"href":"https:\/\/parspack.com\/blog\/wp-json\/wp\/v2\/comments?post=22907"}],"version-history":[{"count":3,"href":"https:\/\/parspack.com\/blog\/wp-json\/wp\/v2\/posts\/22907\/revisions"}],"predecessor-version":[{"id":50267,"href":"https:\/\/parspack.com\/blog\/wp-json\/wp\/v2\/posts\/22907\/revisions\/50267"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/parspack.com\/blog\/wp-json\/wp\/v2\/media\/35295"}],"wp:attachment":[{"href":"https:\/\/parspack.com\/blog\/wp-json\/wp\/v2\/media?parent=22907"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/parspack.com\/blog\/wp-json\/wp\/v2\/categories?post=22907"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/parspack.com\/blog\/wp-json\/wp\/v2\/tags?post=22907"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}