User Tools

Site Tools


python

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
python [2024/11/17 12:59] – external edit 127.0.0.1python [2026/03/27 00:52] (current) – Update deprecated Python 2.7 assert methods to Python 3 equivalents roger
Line 21: Line 21:
 | assertNotIsInstance      | not is instance(a,b)                    | 2.7 | | assertNotIsInstance      | not is instance(a,b)                    | 2.7 |
 | assertRaises             | fun(*args,**kwds) raises exc            |     | | assertRaises             | fun(*args,**kwds) raises exc            |     |
-| assertRaisesRegexp       | fun(*args,**kwds) raises exc(regex)     | 2.7 |+| assertRaisesRegex        | fun(*args,**kwds) raises exc(regex)     | 3.2 |
 | assertAlmostEqual        | round(a-b,7) == 0                       |     | | assertAlmostEqual        | round(a-b,7) == 0                       |     |
 | assertNotAlmostEqual     | round(a-b,7) != 0                       |     | | assertNotAlmostEqual     | round(a-b,7) != 0                       |     |
Line 28: Line 28:
 | assertLess               | a < b                                   | 2.7 | | assertLess               | a < b                                   | 2.7 |
 | assertLessEqual          | a <= b                                  | 2.7 | | assertLessEqual          | a <= b                                  | 2.7 |
-| assertRegexpMatches      | r.search(s)                             | 2.7 | +| assertRegex              | r.search(s)                             | 3.2 | 
-| assertNotRegexpMatches   | not r.search(s)                         | 2.7 | +| assertNotRegex           | not r.search(s)                         | 3.2 | 
-| assertItemsEqual         | sorted(a) == sorted(b)                  | 2.7 | +| assertCountEqual         | sorted(a) == sorted(b)                  | 3.2 | 
-| assertDictContainsSubset | all the key/value pairs in a exist in b | 2.7 |+| assertDictContainsSubset | all the key/value pairs in a exist in b | 2.7 (removed in 3.2) |
 | assertMultiLineEqual     | strings                                 | 2.7 | | assertMultiLineEqual     | strings                                 | 2.7 |
 | assertSequenceEqual      | sequences                               | 2.7 | | assertSequenceEqual      | sequences                               | 2.7 |
python.txt · Last modified: 2026/03/27 00:52 by roger