(self)
| 1250 | self.assertRaises(self.failureException, self.assertLessEqual, b'bug', b'ant') |
| 1251 | |
| 1252 | def testAssertMultiLineEqual(self): |
| 1253 | sample_text = """\ |
| 1254 | http://www.python.org/doc/2.3/lib/module-unittest.html |
| 1255 | test case |
| 1256 | A test case is the smallest unit of testing. [...] |
| 1257 | """ |
| 1258 | revised_sample_text = """\ |
| 1259 | http://www.python.org/doc/2.4.1/lib/module-unittest.html |
| 1260 | test 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" |
nothing calls this directly
no test coverage detected