summaryrefslogtreecommitdiff
path: root/tests/test_extensions.py
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2019-06-12 13:28:13 -0700
committerWaylan Limberg <waylan.limberg@icloud.com>2019-06-13 11:45:25 -0400
commitf9f1a26214c04e776ffd31082be345992b7dc931 (patch)
treeb9ea9f929ebbc75f0c1215d1430a0d985664550f /tests/test_extensions.py
parentcb9cdc86575dab7afd3296c030e338cea3fc936e (diff)
downloadpython-markdown-f9f1a26214c04e776ffd31082be345992b7dc931.tar.gz
Use more specific asserts throughout tests
In the event that a test fails, a more specific assert will usually provide more useful information about what went wrong. Prefer assertIs(..., True) over assertTrue() to assert the type as well as the truthy value. This is recommended by Python: https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertTrue > Note that this is equivalent to bool(expr) is True and not to expr is > True (use assertIs(expr, True) for the latter). This method should > also be avoided when more specific methods are available (e.g. > assertEqual(a, b) instead of assertTrue(a == b)), because they provide > a better error message in case of failure.
Diffstat (limited to 'tests/test_extensions.py')
-rw-r--r--tests/test_extensions.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/test_extensions.py b/tests/test_extensions.py
index b4c0779..bd78777 100644
--- a/tests/test_extensions.py
+++ b/tests/test_extensions.py
@@ -447,7 +447,7 @@ line 3
'fenced_code'
]
)
- self.assertTrue('<code class="language-python">' in md.convert(text))
+ self.assertIn('<code class="language-python">', md.convert(text))
def testFencedLanguageDoubleEscape(self):
""" Test entity escape logic in fences. """