diff options
author | Patrick Lehmann <Patrick.Lehmann@plc2.de> | 2021-06-30 01:38:41 +0200 |
---|---|---|
committer | Patrick Lehmann <Patrick.Lehmann@plc2.de> | 2021-07-01 06:39:46 +0200 |
commit | 8a815d48790db46652034b6a72a581b0c9f40f40 (patch) | |
tree | 82cc9435e1600c6b27503727c635bb43cf7d0dc7 /testsuite/pyunit | |
parent | 6acaf4b6baba21f8eca7520f518c62ffd75abd04 (diff) | |
download | ghdl-8a815d48790db46652034b6a72a581b0c9f40f40.tar.gz ghdl-8a815d48790db46652034b6a72a581b0c9f40f40.tar.bz2 ghdl-8a815d48790db46652034b6a72a581b0c9f40f40.zip |
Improved test code.
Diffstat (limited to 'testsuite/pyunit')
-rw-r--r-- | testsuite/pyunit/dom/Expressions.py | 2 | ||||
-rw-r--r-- | testsuite/pyunit/dom/Literals.py | 8 | ||||
-rw-r--r-- | testsuite/pyunit/dom/SimpleEntity.py | 6 | ||||
-rw-r--r-- | testsuite/pyunit/dom/SimplePackage.py | 4 |
4 files changed, 10 insertions, 10 deletions
diff --git a/testsuite/pyunit/dom/Expressions.py b/testsuite/pyunit/dom/Expressions.py index 21b0cd03b..175ff9cdd 100644 --- a/testsuite/pyunit/dom/Expressions.py +++ b/testsuite/pyunit/dom/Expressions.py @@ -89,7 +89,7 @@ class Expressions(TestCase): # Start checks self.assertIsInstance(default, InverseExpression) self.assertIsInstance(default.Operand, SimpleObjectOrFunctionCallSymbol) - self.assertTrue(str(default.Operand.SymbolName) == "true") + self.assertEqual(str(default.Operand.SymbolName), "true") # def test_AbsExpression(self): # filename: Path = self._root / "{className}_{funcName}.vhdl".format( diff --git a/testsuite/pyunit/dom/Literals.py b/testsuite/pyunit/dom/Literals.py index 9dc40d4cb..f54f7484b 100644 --- a/testsuite/pyunit/dom/Literals.py +++ b/testsuite/pyunit/dom/Literals.py @@ -74,12 +74,12 @@ class Literals(TestCase): self.assertEqual(len(design.Documents[0].Packages), 1) package = design.Documents[0].Packages[0] - self.assertTrue(package.Identifier == "package_1") + self.assertEqual(package.Identifier, "package_1") self.assertEqual(len(package.DeclaredItems), len(expected)) for i in range(len(expected)): item: Constant = package.DeclaredItems[i] self.assertIsInstance(item, Constant) - self.assertTrue(item.Identifier == "c{}".format(i)) - self.assertTrue(str(item.SubType.SymbolName) == "integer") + self.assertEqual(item.Identifier, "c{}".format(i)) + self.assertEqual(str(item.SubType.SymbolName), "integer") self.assertIsInstance(item.DefaultExpression, IntegerLiteral) - self.assertTrue(item.DefaultExpression.Value == expected[i]) + self.assertEqual(item.DefaultExpression.Value, expected[i]) diff --git a/testsuite/pyunit/dom/SimpleEntity.py b/testsuite/pyunit/dom/SimpleEntity.py index 3ea3967a0..657e8abeb 100644 --- a/testsuite/pyunit/dom/SimpleEntity.py +++ b/testsuite/pyunit/dom/SimpleEntity.py @@ -59,7 +59,7 @@ class SimpleEntity(TestCase): document = Document(self._filename) design.Documents.append(document) - self.assertTrue(len(design.Documents) == 1) + self.assertEqual(len(design.Documents), 1) def test_Entity(self): design = Design() @@ -67,7 +67,7 @@ class SimpleEntity(TestCase): design.Documents.append(document) self.assertEqual(len(design.Documents[0].Entities), 1) - self.assertTrue(design.Documents[0].Entities[0].Identifier == "entity_1") + self.assertEqual(design.Documents[0].Entities[0].Identifier, "entity_1") def test_Architecture(self): design = Design() @@ -75,4 +75,4 @@ class SimpleEntity(TestCase): design.Documents.append(document) self.assertEqual(len(design.Documents[0].Architectures), 1) - self.assertTrue(design.Documents[0].Architectures[0].Identifier == "behav") + self.assertEqual(design.Documents[0].Architectures[0].Identifier, "behav") diff --git a/testsuite/pyunit/dom/SimplePackage.py b/testsuite/pyunit/dom/SimplePackage.py index c2a26d427..d107d7206 100644 --- a/testsuite/pyunit/dom/SimplePackage.py +++ b/testsuite/pyunit/dom/SimplePackage.py @@ -52,7 +52,7 @@ class SimplePackage(TestCase): design.Documents.append(document) self.assertEqual(len(design.Documents[0].Packages), 1) - self.assertTrue(design.Documents[0].Packages[0].Identifier == "pack_1") + self.assertEqual(design.Documents[0].Packages[0].Identifier, "pack_1") def test_PackageBody(self): design = Design() @@ -60,4 +60,4 @@ class SimplePackage(TestCase): design.Documents.append(document) self.assertEqual(len(design.Documents[0].PackageBodies), 1) - self.assertTrue(design.Documents[0].PackageBodies[0].Identifier == "pack_1") + self.assertEqual(design.Documents[0].PackageBodies[0].Identifier, "pack_1") |