From 03f5a6cd6f88aef6c6580f471905403056313f05 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Wed, 30 Jun 2021 12:20:54 +0200 Subject: Exchanged sides in asserts to the understanding of pytests actual vs. expected order. --- pyGHDL/dom/Range.py | 7 +------ testsuite/pyunit/dom/Expressions.py | 2 +- testsuite/pyunit/dom/Literals.py | 12 ++++++------ testsuite/pyunit/dom/SimpleEntity.py | 10 +++++----- testsuite/pyunit/dom/SimplePackage.py | 8 ++++---- 5 files changed, 17 insertions(+), 22 deletions(-) diff --git a/pyGHDL/dom/Range.py b/pyGHDL/dom/Range.py index d091be1c6..ce8dfbc40 100644 --- a/pyGHDL/dom/Range.py +++ b/pyGHDL/dom/Range.py @@ -44,9 +44,4 @@ __all__ = [] @export class Range(VHDLModel_Range): - def __init__(self, left: Expression, right: Expression, direction: Direction): - super().__init__() - - self._leftBound = left - self._rightBound = right - self._direction = direction + pass diff --git a/testsuite/pyunit/dom/Expressions.py b/testsuite/pyunit/dom/Expressions.py index 175ff9cdd..113e541ac 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.assertEqual(str(default.Operand.SymbolName), "true") + self.assertEqual("true", str(default.Operand.SymbolName)) # 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 f54f7484b..60938c52e 100644 --- a/testsuite/pyunit/dom/Literals.py +++ b/testsuite/pyunit/dom/Literals.py @@ -72,14 +72,14 @@ class Literals(TestCase): document = Document(self._filename) design.Documents.append(document) - self.assertEqual(len(design.Documents[0].Packages), 1) + self.assertEqual(1, len(design.Documents[0].Packages)) package = design.Documents[0].Packages[0] - self.assertEqual(package.Identifier, "package_1") - self.assertEqual(len(package.DeclaredItems), len(expected)) + self.assertEqual("package_1", package.Identifier) + self.assertEqual(len(expected), len(package.DeclaredItems)) for i in range(len(expected)): item: Constant = package.DeclaredItems[i] self.assertIsInstance(item, Constant) - self.assertEqual(item.Identifier, "c{}".format(i)) - self.assertEqual(str(item.SubType.SymbolName), "integer") + self.assertEqual("c{}".format(i), item.Identifier) + self.assertEqual("integer", str(item.Subtype.SymbolName)) self.assertIsInstance(item.DefaultExpression, IntegerLiteral) - self.assertEqual(item.DefaultExpression.Value, expected[i]) + self.assertEqual(expected[i], item.DefaultExpression.Value) diff --git a/testsuite/pyunit/dom/SimpleEntity.py b/testsuite/pyunit/dom/SimpleEntity.py index 657e8abeb..68f702410 100644 --- a/testsuite/pyunit/dom/SimpleEntity.py +++ b/testsuite/pyunit/dom/SimpleEntity.py @@ -59,20 +59,20 @@ class SimpleEntity(TestCase): document = Document(self._filename) design.Documents.append(document) - self.assertEqual(len(design.Documents), 1) + self.assertEqual(1, len(design.Documents)) def test_Entity(self): design = Design() document = Document(self._filename) design.Documents.append(document) - self.assertEqual(len(design.Documents[0].Entities), 1) - self.assertEqual(design.Documents[0].Entities[0].Identifier, "entity_1") + self.assertEqual(1, len(design.Documents[0].Entities)) + self.assertEqual("entity_1", design.Documents[0].Entities[0].Identifier) def test_Architecture(self): design = Design() document = Document(self._filename) design.Documents.append(document) - self.assertEqual(len(design.Documents[0].Architectures), 1) - self.assertEqual(design.Documents[0].Architectures[0].Identifier, "behav") + self.assertEqual(1, len(design.Documents[0].Architectures)) + self.assertEqual("behav", design.Documents[0].Architectures[0].Identifier) diff --git a/testsuite/pyunit/dom/SimplePackage.py b/testsuite/pyunit/dom/SimplePackage.py index d107d7206..9c62db4a1 100644 --- a/testsuite/pyunit/dom/SimplePackage.py +++ b/testsuite/pyunit/dom/SimplePackage.py @@ -51,13 +51,13 @@ class SimplePackage(TestCase): document = Document(self._filename) design.Documents.append(document) - self.assertEqual(len(design.Documents[0].Packages), 1) - self.assertEqual(design.Documents[0].Packages[0].Identifier, "pack_1") + self.assertEqual(1, len(design.Documents[0].Packages)) + self.assertEqual("pack_1", design.Documents[0].Packages[0].Identifier) def test_PackageBody(self): design = Design() document = Document(self._filename) design.Documents.append(document) - self.assertEqual(len(design.Documents[0].PackageBodies), 1) - self.assertEqual(design.Documents[0].PackageBodies[0].Identifier, "pack_1") + self.assertEqual(1, len(design.Documents[0].PackageBodies)) + self.assertEqual("pack_1", design.Documents[0].PackageBodies[0].Identifier) -- cgit v1.2.3