From a897ea0af0792dbb721c47dff49f222e409c4334 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Thu, 18 Jan 2024 15:09:22 +1100 Subject: [PATCH] Clean up test assertions Python 3.1 and 3.2 massively cleaned up and reorganized assert* methods in TestCase, all for the better. A large amount of methods were then deprecated, and they have finally been removed in Python 3.12. Clean up the callsites. --- src/actdiag/tests/test_rst_directives.py | 37 ++++++++++-------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/src/actdiag/tests/test_rst_directives.py b/src/actdiag/tests/test_rst_directives.py index 9af9ff7..4738970 100644 --- a/src/actdiag/tests/test_rst_directives.py +++ b/src/actdiag/tests/test_rst_directives.py @@ -47,11 +47,11 @@ def test_setup(self): self.assertEqual(directives.ActdiagDirective, docutils._directives['actdiag']) self.assertEqual('PNG', options['format']) - self.assertEqual(False, options['antialias']) - self.assertEqual(None, options['fontpath']) - self.assertEqual(False, options['nodoctype']) - self.assertEqual(False, options['noviewbox']) - self.assertEqual(False, options['inline_svg']) + self.assertFalse(options['antialias']) + self.assertIsNone(options['fontpath']) + self.assertFalse(options['nodoctype']) + self.assertFalse(options['noviewbox']) + self.assertFalse(options['inline_svg']) def test_setup_with_args(self): directives.setup(format='SVG', antialias=True, fontpath='/dev/null', @@ -62,11 +62,11 @@ def test_setup_with_args(self): self.assertEqual(directives.ActdiagDirective, docutils._directives['actdiag']) self.assertEqual('SVG', options['format']) - self.assertEqual(True, options['antialias']) + self.assertTrue(options['antialias']) self.assertEqual('/dev/null', options['fontpath']) - self.assertEqual(True, options['nodoctype']) - self.assertEqual(True, options['noviewbox']) - self.assertEqual(True, options['inline_svg']) + self.assertTrue(options['nodoctype']) + self.assertTrue(options['noviewbox']) + self.assertTrue(options['inline_svg']) @capture_stderr def test_cleanup(self): @@ -131,7 +131,7 @@ def test_setup_noviewbox_is_true(self): self.assertEqual(1, len(doctree)) self.assertEqual(nodes.image, type(doctree[0])) svg = open(doctree[0]['uri']).read() - self.assertRegexpMatches(svg, r'