MCPcopy Index your code
hub / github.com/python/cpython / testAssertMultiLineEqual

Method testAssertMultiLineEqual

Lib/test/test_unittest/test_case.py:1252–1283  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1250 self.assertRaises(self.failureException, self.assertLessEqual, b'bug', b'ant')
1251
1252 def testAssertMultiLineEqual(self):
1253 sample_text = """\
1254http://www.python.org/doc/2.3/lib/module-unittest.html
1255test case
1256 A test case is the smallest unit of testing. [...]
1257"""
1258 revised_sample_text = """\
1259http://www.python.org/doc/2.4.1/lib/module-unittest.html
1260test case
1261 A test case is the smallest unit of testing. [...] You may provide your
1262 own implementation that does not subclass from TestCase, of course.
1263"""
1264 sample_text_error = """\
1265- http://www.python.org/doc/2.3/lib/module-unittest.html
1266? ^
1267+ http://www.python.org/doc/2.4.1/lib/module-unittest.html
1268? ^^^
1269 test case
1270- A test case is the smallest unit of testing. [...]
1271+ A test case is the smallest unit of testing. [...] You may provide your
1272? +++++++++++++++++++++
1273+ own implementation that does not subclass from TestCase, of course.
1274"""
1275 self.maxDiff = None
1276 try:
1277 self.assertMultiLineEqual(sample_text, revised_sample_text)
1278 except self.failureException as e:
1279 # need to remove the first line of the error message
1280 error = str(e).split('\n', 1)[1]
1281 self.assertEqual(sample_text_error, error)
1282 else:
1283 self.fail(f'{self.failureException} not raised')
1284
1285 def testAssertEqualSingleLine(self):
1286 sample_text = "laden swallows fly slowly"

Callers

nothing calls this directly

Calls 5

strFunction · 0.85
assertMultiLineEqualMethod · 0.80
splitMethod · 0.45
assertEqualMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected