コード例 #1
0
 def test_nothing_equal(self):
     example = doctest2.Example("print(x)", "")
     result = self.checker.output_difference(example, "", 0)
     expected = "\n".join([
         "Expected nothing",
         "Got nothing\n",
     ])
     self.assertEqual(result, expected)
コード例 #2
0
 def test_simple_diff(self):
     example = doctest2.Example("print(x)", "foo")
     result = self.checker.output_difference(example, "bar", 0)
     expected = "\n".join([
         "Expected:",
         "    foo",
         "Got:",
         "    bar",
     ])
     self.assertEqual(result, expected)
コード例 #3
0
 def test_missing_blankline(self):
     example = doctest2.Example("print(x)", "foo\n<BLANKLINE>\nbar")
     result = self.checker.output_difference(example, "foo\nbar", 0)
     expected = "\n".join([
         "Expected:",
         "    foo",
         "    <BLANKLINE>",
         "    bar",
         "Got:",
         "    foo",
         "    bar",
     ])
     self.assertEqual(result, expected)