Unittest - Example of TAP diag use in template.t
* Also prettify its output with the amazing whitespace
This commit is contained in:
@@ -8,7 +8,7 @@ class TestCase(unittest.TestCase):
|
|||||||
def diag(self, out):
|
def diag(self, out):
|
||||||
sys.stdout.write("# --- diag start ---\n")
|
sys.stdout.write("# --- diag start ---\n")
|
||||||
for line in out.split("\n"):
|
for line in out.split("\n"):
|
||||||
sys.stdout.write("#" + line + "\n")
|
sys.stdout.write("# " + line + "\n")
|
||||||
sys.stdout.write("# --- diag end ---\n")
|
sys.stdout.write("# --- diag end ---\n")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ class TestBugNumber(TestCase):
|
|||||||
expected = "Copyright \(C\) \d{4} - %d" % (datetime.now().year,)
|
expected = "Copyright \(C\) \d{4} - %d" % (datetime.now().year,)
|
||||||
self.assertRegexpMatches(out.decode("utf8"), expected)
|
self.assertRegexpMatches(out.decode("utf8"), expected)
|
||||||
|
|
||||||
|
# TAP diagnostics on the bas
|
||||||
|
self.diag("Yay TAP diagnostics")
|
||||||
|
|
||||||
def test_fail_other(self):
|
def test_fail_other(self):
|
||||||
"""Nothing to do with Copyright"""
|
"""Nothing to do with Copyright"""
|
||||||
self.assertEqual("I like to code", "I like\nto code\n")
|
self.assertEqual("I like to code", "I like\nto code\n")
|
||||||
|
|||||||
Reference in New Issue
Block a user