From 9c65e9ba2d0a5782f363a637eb1d51228a36f0e3 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Fri, 2 Feb 2024 16:15:35 +0200 Subject: [PATCH] gio: tests: Use slightly more explicit assert functions Found by using teyit [1] on the code https://github.com/isidentical/teyit --- gio/tests/codegen.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gio/tests/codegen.py b/gio/tests/codegen.py index 0681bb4e8..39c848f8a 100644 --- a/gio/tests/codegen.py +++ b/gio/tests/codegen.py @@ -479,7 +479,7 @@ G_END_DECLS self.assertEqual("", res.out) with open("test-org.project.Bar.Frobnicator.xml", "r") as f: xml_data = f.readlines() - self.assertTrue(len(xml_data) != 0) + self.assertNotEqual(len(xml_data), 0) def test_generate_md(self): """Test the basic functionality of the markdown generator.""" @@ -499,7 +499,7 @@ G_END_DECLS self.assertEqual("", res.out) with open("test-org.project.Bar.Frobnicator.md", "r") as f: rst = f.readlines() - self.assertTrue(len(rst) != 0) + self.assertNotEqual(len(rst), 0) def test_generate_rst(self): """Test the basic functionality of the rst generator.""" @@ -519,7 +519,7 @@ G_END_DECLS self.assertEqual("", res.out) with open("test-org.project.Bar.Frobnicator.rst", "r") as f: rst = f.readlines() - self.assertTrue(len(rst) != 0) + self.assertNotEqual(len(rst), 0) def test_generate_rst_method(self): """Test generating a method documentation with the rst generator.""" @@ -1472,7 +1472,7 @@ G_END_DECLS self.assertEqual("", res.err) self.assertEqual("", res.out) with open("test-org.project.Bar.Frobnicator.xml", "r") as f: - self.assertTrue(ET.parse(f) is not None) + self.assertIsNotNone(ET.parse(f)) def test_indentation_preservation_in_comments(self): """Test if the parser preserves relative indentation in XML comments"""