Skip to content

Commit

Permalink
<Update>[Naming]: <Fix unit tests πŸ”₯ 🎨 βœ…>
Browse files Browse the repository at this point in the history
[]

[#79]
  • Loading branch information
Humberto Sanchez II committed Jun 8, 2024
1 parent 343ddb6 commit 03748b6
Show file tree
Hide file tree
Showing 16 changed files with 49 additions and 98 deletions.
2 changes: 1 addition & 1 deletion tests/ProjectTestBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
TEST_XML_FILENAME: str = 'MultiDocumentProject.xml'


class TestBase(UnitTestBaseW):
class ProjectTestBase(UnitTestBaseW):

V10_TEST_FILES_PACKAGE_NAME: str = f'{UnitTestBase.RESOURCES_PACKAGE_NAME}.v10'
V11_TEST_FILES_PACKAGE_NAME: str = f'{UnitTestBase.RESOURCES_PACKAGE_NAME}.v11'
Expand Down
49 changes: 0 additions & 49 deletions tests/TestTemplate.py

This file was deleted.

10 changes: 5 additions & 5 deletions tests/TestUnTangleProjectInformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
from unittest import TestSuite
from unittest import main as unitTestMain

from tests.ProjectTestBase import TestBase
from tests.ProjectTestBase import ProjectTestBase
from untanglepyut.Types import ProjectInformation
from untanglepyut.UnTangleProjectInformation import UnTangleProjectInformation
from untanglepyut.UnsupportedFileTypeException import UnsupportedFileTypeException


class TestUnTangleProjectInformation(TestBase):
class TestUnTangleProjectInformation(ProjectTestBase):
"""
"""

Expand All @@ -28,14 +28,14 @@ def testIncorrectExtension(self):
unTangleProjectInformation: UnTangleProjectInformation = UnTangleProjectInformation(fqFileName='HokeyXmlFileName.opie')

def testV10ProjectInformation(self):
self._testProjectInformation(package=TestBase.V10_TEST_FILES_PACKAGE_NAME, fileName='EmptyDiagram.xml', expectedVersion='10')
self._testProjectInformation(package=ProjectTestBase.V10_TEST_FILES_PACKAGE_NAME, fileName='EmptyDiagram.xml', expectedVersion='10')

def testV11ProjectInformation(self):
self._testProjectInformation(package=TestBase.V11_TEST_FILES_PACKAGE_NAME, fileName='EmptyDiagram.xml', expectedVersion='11')
self._testProjectInformation(package=ProjectTestBase.V11_TEST_FILES_PACKAGE_NAME, fileName='EmptyDiagram.xml', expectedVersion='11')

def _testProjectInformation(self, package: str, fileName: str, expectedVersion: str):

fqFileName: str = TestBase.getFullyQualifiedResourceFileName(package=package, fileName=fileName)
fqFileName: str = ProjectTestBase.getFullyQualifiedResourceFileName(package=package, fileName=fileName)
unTangleProjectInformation: UnTangleProjectInformation = UnTangleProjectInformation(fqFileName=fqFileName)
projectInformation: ProjectInformation = unTangleProjectInformation.projectInformation

Expand Down
4 changes: 2 additions & 2 deletions tests/untangledemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

import untangle

from tests.ProjectTestBase import TestBase
from tests.ProjectTestBase import ProjectTestBase

fqFileName = resource_filename(TestBase.RESOURCES_PACKAGE_NAME, 'MultiDocumentProject.xml')
fqFileName = resource_filename(ProjectTestBase.RESOURCES_PACKAGE_NAME, 'MultiDocumentProject.xml')

with open(fqFileName, "r") as xmlFile:
xmlString: str = xmlFile.read()
Expand Down
4 changes: 2 additions & 2 deletions tests/untanglepyut/TestUnTangleOglClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

from untanglepyut.UnTangleOglClasses import UnTangleOglClasses

from tests.ProjectTestBase import TestBase
from tests.ProjectTestBase import ProjectTestBase

V11_OGL_CLASS_DOCUMENT: str = """
<PyutDocument type="CLASS_DIAGRAM" title="SingleClassDiagram" scrollPositionX="0" scrollPositionY="0" pixelsPerUnitX="20" pixelsPerUnitY="20">
Expand Down Expand Up @@ -110,7 +110,7 @@
"""


class TestUnTangleOglClass(TestBase):
class TestUnTangleOglClass(ProjectTestBase):
"""
Auto generated by the one and only:
Gato Malo - Humberto A. Sanchez II
Expand Down
4 changes: 2 additions & 2 deletions tests/untanglepyut/TestUnTangleOglNotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from untanglepyut.UnTangleOglNotes import UnTangleOglNotes


from tests.ProjectTestBase import TestBase
from tests.ProjectTestBase import ProjectTestBase

V11_MANY_NOTES_DOCUMENT: str = """
<PyutDocument type="CLASS_DIAGRAM" title="Class Diagram" scrollPositionX="0" scrollPositionY="0" pixelsPerUnitX="20" pixelsPerUnitY="20">
Expand Down Expand Up @@ -48,7 +48,7 @@
"""


class TestUnTangleOglNotes(TestBase):
class TestUnTangleOglNotes(ProjectTestBase):
"""
"""
@classmethod
Expand Down
4 changes: 2 additions & 2 deletions tests/untanglepyut/TestUnTangleOglTexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from untanglepyut.UnTangleOglTexts import UnTangleOglTexts
from untanglepyut.XmlVersion import XmlVersion

from tests.ProjectTestBase import TestBase
from tests.ProjectTestBase import ProjectTestBase

V10_MANY_TEXTS_DOCUMENT: str = """
<PyutDocument type="CLASS_DIAGRAM" title="Lots Of Text" scrollPositionX="0" scrollPositionY="0" pixelsPerUnitX="20" pixelsPerUnitY="20">
Expand Down Expand Up @@ -43,7 +43,7 @@
"""


class TestUnTangleOglTexts(TestBase):
class TestUnTangleOglTexts(ProjectTestBase):
"""
"""

Expand Down
6 changes: 3 additions & 3 deletions tests/untanglepyut/TestUnTangler.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
from untanglepyut.UnTangler import UnTangler
from untanglepyut.XmlVersion import XmlVersion

from tests.ProjectTestBase import TestBase
from tests.ProjectTestBase import ProjectTestBase


class TestUnTangler(TestBase):
class TestUnTangler(ProjectTestBase):
"""
Auto generated by the one and only:
Gato Malo – Humberto A. Sanchez II
Expand All @@ -40,7 +40,7 @@ def tearDown(self):

def testLollipopInterfaceMultiImplementor(self):

fqFileName: str = UnitTestBase.getFullyQualifiedResourceFileName(package=TestBase.V11_TEST_FILES_PACKAGE_NAME,
fqFileName: str = UnitTestBase.getFullyQualifiedResourceFileName(package=ProjectTestBase.V11_TEST_FILES_PACKAGE_NAME,
fileName='LollipopInterfaceMultiImplementor.xml')
untangler: UnTangler = UnTangler(xmlVersion=XmlVersion.V11)

Expand Down
12 changes: 6 additions & 6 deletions tests/untanglepyut/v10/TestUnTangleOglLinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from tests.ProjectTestBase import DIAGRAM_NAME_1
from tests.ProjectTestBase import DIAGRAM_NAME_2
from tests.ProjectTestBase import TEST_XML_FILENAME
from tests.ProjectTestBase import TestBase
from tests.ProjectTestBase import ProjectTestBase

from untanglepyut.Types import Document
from untanglepyut.Types import DocumentTitle
Expand All @@ -36,23 +36,23 @@
from untanglepyut.UnTangler import UnTangler


class TestUnTangleOglLinks(TestBase):
class TestUnTangleOglLinks(ProjectTestBase):
"""
"""
SIMPLE_DIAGRAM_NAME: DocumentTitle = DocumentTitle('Simple')

def setUp(self):

super().setUp()
self._fqFileName: str = TestBase.getFullyQualifiedResourceFileName(TestBase.V10_TEST_FILES_PACKAGE_NAME, TEST_XML_FILENAME)
self._fqFileName: str = ProjectTestBase.getFullyQualifiedResourceFileName(ProjectTestBase.V10_TEST_FILES_PACKAGE_NAME, TEST_XML_FILENAME)

self._mockDC: MagicMock = MagicMock()

def tearDown(self):
super().tearDown()

def testNoGraphicLinks(self):
fqFileName: str = TestBase.getFullyQualifiedResourceFileName(TestBase.V10_TEST_FILES_PACKAGE_NAME, 'ScaffoldDiagram.xml')
fqFileName: str = ProjectTestBase.getFullyQualifiedResourceFileName(ProjectTestBase.V10_TEST_FILES_PACKAGE_NAME, 'ScaffoldDiagram.xml')
untangler: UnTangler = UnTangler(xmlVersion=XmlVersion.V10)

untangler.untangleFile(fqFileName)
Expand All @@ -69,7 +69,7 @@ def testGraphicSimpleLinks(self):

def testSimpleInheritance(self):

fqFileName: str = TestBase.getFullyQualifiedResourceFileName(TestBase.V10_TEST_FILES_PACKAGE_NAME, 'SimpleInheritance.xml')
fqFileName: str = ProjectTestBase.getFullyQualifiedResourceFileName(ProjectTestBase.V10_TEST_FILES_PACKAGE_NAME, 'SimpleInheritance.xml')
untangler: UnTangler = UnTangler(XmlVersion.V10)

untangler.untangleFile(fqFileName=fqFileName)
Expand Down Expand Up @@ -162,7 +162,7 @@ def testLollipopInterfaceMethodsCreated(self):

def testGetAssociationLabelPositions(self):

fqFileName: str = TestBase.getFullyQualifiedResourceFileName(TestBase.V10_TEST_FILES_PACKAGE_NAME, 'SimpleGraphicLinkTest.xml')
fqFileName: str = ProjectTestBase.getFullyQualifiedResourceFileName(ProjectTestBase.V10_TEST_FILES_PACKAGE_NAME, 'SimpleGraphicLinkTest.xml')
untangler: UnTangler = UnTangler(XmlVersion.V10)

untangler.untangleFile(fqFileName)
Expand Down
6 changes: 3 additions & 3 deletions tests/untanglepyut/v10/TestUnTangleSequenceDiagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@

from untanglepyut.UnTangler import UnTangler

from tests.ProjectTestBase import TestBase
from tests.ProjectTestBase import ProjectTestBase


class TestUnTangleSequenceDiagram(TestBase):
class TestUnTangleSequenceDiagram(ProjectTestBase):
"""
"""
def setUp(self):
Expand Down Expand Up @@ -96,7 +96,7 @@ def testSDInstanceLifeLineIsCorrect(self):

def _retrieveSequenceDiagramDocument(self) -> Document:

fqFileName: str = TestBase.getFullyQualifiedResourceFileName(TestBase.V10_TEST_FILES_PACKAGE_NAME, 'SequenceDiagram.xml')
fqFileName: str = ProjectTestBase.getFullyQualifiedResourceFileName(ProjectTestBase.V10_TEST_FILES_PACKAGE_NAME, 'SequenceDiagram.xml')
untangler: UnTangler = UnTangler(XmlVersion.V10)

untangler.untangleFile(fqFileName=fqFileName)
Expand Down
8 changes: 4 additions & 4 deletions tests/untanglepyut/v10/TestUnTangleUseCase.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

from untanglepyut.UnTangler import UnTangler

from tests.ProjectTestBase import TestBase
from tests.ProjectTestBase import ProjectTestBase


class TestUnTangleUseCase(TestBase):
class TestUnTangleUseCase(ProjectTestBase):
"""
"""
@classmethod
Expand All @@ -33,7 +33,7 @@ def tearDown(self):
super().tearDown()

def testUseCaseDiagramNotesTexts(self):
fqFileName: str = TestBase.getFullyQualifiedResourceFileName(TestBase.V10_TEST_FILES_PACKAGE_NAME, 'UseCasesTextNotes.xml')
fqFileName: str = ProjectTestBase.getFullyQualifiedResourceFileName(ProjectTestBase.V10_TEST_FILES_PACKAGE_NAME, 'UseCasesTextNotes.xml')
untangler: UnTangler = UnTangler(XmlVersion.V10)

untangler.untangleFile(fqFileName=fqFileName)
Expand Down Expand Up @@ -71,7 +71,7 @@ def testUseCaseDiagramLinks(self):

def _retrieveUseCaseDocument(self) -> Document:

fqFileName: str = TestBase.getFullyQualifiedResourceFileName(TestBase.V10_TEST_FILES_PACKAGE_NAME, 'UseCaseDiagram.xml')
fqFileName: str = ProjectTestBase.getFullyQualifiedResourceFileName(ProjectTestBase.V10_TEST_FILES_PACKAGE_NAME, 'UseCaseDiagram.xml')
untangler: UnTangler = UnTangler(XmlVersion.V10)

untangler.untangleFile(fqFileName=fqFileName)
Expand Down
22 changes: 11 additions & 11 deletions tests/untanglepyut/v10/TestUnTangler.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,20 @@

from untanglepyut.UnTangler import UnTangler

from tests.ProjectTestBase import TestBase
from tests.ProjectTestBase import ProjectTestBase

ATM_DIAGRAM_NAME: DocumentTitle = DocumentTitle('Class Diagram')
SIMPLE_DIAGRAM_NAME: DocumentTitle = DocumentTitle('Simple')


class TestUnTangler(TestBase):
class TestUnTangler(ProjectTestBase):
"""
"""
def setUp(self):

super().setUp()

traversable: Traversable = files(TestBase.V10_TEST_FILES_PACKAGE_NAME) / TEST_XML_FILENAME
traversable: Traversable = files(ProjectTestBase.V10_TEST_FILES_PACKAGE_NAME) / TEST_XML_FILENAME
self._fqFileName: str = str(traversable)

def tearDown(self):
Expand Down Expand Up @@ -94,7 +94,7 @@ def testUntangleXml(self):
self.assertEqual(2, len(untangler.documents), 'Incorrect number of documents created')

def testControlPointsGenerated(self):
fqFileName: str = TestBase.getFullyQualifiedResourceFileName(package=TestBase.V10_TEST_FILES_PACKAGE_NAME, fileName='ATM-Model.xml')
fqFileName: str = ProjectTestBase.getFullyQualifiedResourceFileName(package=ProjectTestBase.V10_TEST_FILES_PACKAGE_NAME, fileName='ATM-Model.xml')
untangler: UnTangler = UnTangler(XmlVersion.V10)

untangler.untangleFile(fqFileName=fqFileName)
Expand Down Expand Up @@ -191,7 +191,7 @@ def testPyutMethodsWithParameters(self):

def testPyutMethodModifiers(self):

fqFileName: str = TestBase.getFullyQualifiedResourceFileName(TestBase.V10_TEST_FILES_PACKAGE_NAME, 'MultiMethodModifier.xml')
fqFileName: str = ProjectTestBase.getFullyQualifiedResourceFileName(ProjectTestBase.V10_TEST_FILES_PACKAGE_NAME, 'MultiMethodModifier.xml')
untangler: UnTangler = UnTangler(XmlVersion.V10)
untangler.untangleFile(fqFileName=fqFileName)

Expand Down Expand Up @@ -253,7 +253,7 @@ def emptyTest(oglClass) -> bool:
self._runTest(DIAGRAM_NAME_1, emptyTest)

def testUmlNote(self):
fqFileName: str = TestBase.getFullyQualifiedResourceFileName(TestBase.V10_TEST_FILES_PACKAGE_NAME, 'MultiObject.xml')
fqFileName: str = ProjectTestBase.getFullyQualifiedResourceFileName(ProjectTestBase.V10_TEST_FILES_PACKAGE_NAME, 'MultiObject.xml')
untangler: UnTangler = UnTangler(XmlVersion.V10)

untangler.untangleFile(fqFileName=fqFileName)
Expand All @@ -271,7 +271,7 @@ def testUmlNote(self):

def testMultiLineUmlNote(self):

fqFileName: str = TestBase.getFullyQualifiedResourceFileName(TestBase.V10_TEST_FILES_PACKAGE_NAME, 'MultiLineNote.xml')
fqFileName: str = ProjectTestBase.getFullyQualifiedResourceFileName(ProjectTestBase.V10_TEST_FILES_PACKAGE_NAME, 'MultiLineNote.xml')
untangler: UnTangler = UnTangler(XmlVersion.V10)

untangler.untangleFile(fqFileName=fqFileName)
Expand All @@ -290,7 +290,7 @@ def testMultiLineUmlNote(self):

def testUmlText(self):

fqFileName: str = TestBase.getFullyQualifiedResourceFileName(TestBase.V10_TEST_FILES_PACKAGE_NAME, 'MultiObject.xml')
fqFileName: str = ProjectTestBase.getFullyQualifiedResourceFileName(ProjectTestBase.V10_TEST_FILES_PACKAGE_NAME, 'MultiObject.xml')
untangler: UnTangler = UnTangler(XmlVersion.V10)

untangler.untangleFile(fqFileName=fqFileName)
Expand All @@ -301,7 +301,7 @@ def testUmlText(self):

def testOglClassModelUpdated(self):

fqFileName: str = TestBase.getFullyQualifiedResourceFileName(TestBase.V10_TEST_FILES_PACKAGE_NAME, 'ATM-Model.xml')
fqFileName: str = ProjectTestBase.getFullyQualifiedResourceFileName(ProjectTestBase.V10_TEST_FILES_PACKAGE_NAME, 'ATM-Model.xml')
untangler: UnTangler = UnTangler(XmlVersion.V10)

untangler.untangleFile(fqFileName=fqFileName)
Expand All @@ -317,7 +317,7 @@ def testOglClassModelUpdated(self):

def testOglTextModelUpdated(self):

fqFileName: str = TestBase.getFullyQualifiedResourceFileName(TestBase.V10_TEST_FILES_PACKAGE_NAME, 'MultiLinkDocument.xml')
fqFileName: str = ProjectTestBase.getFullyQualifiedResourceFileName(ProjectTestBase.V10_TEST_FILES_PACKAGE_NAME, 'MultiLinkDocument.xml')
untangler: UnTangler = UnTangler(XmlVersion.V10)

untangler.untangleFile(fqFileName=fqFileName)
Expand All @@ -333,7 +333,7 @@ def testOglTextModelUpdated(self):

def testOglClassesWithFields(self):

fqFileName: str = TestBase.getFullyQualifiedResourceFileName(TestBase.V10_TEST_FILES_PACKAGE_NAME, 'MultiLinkDocument.xml')
fqFileName: str = ProjectTestBase.getFullyQualifiedResourceFileName(ProjectTestBase.V10_TEST_FILES_PACKAGE_NAME, 'MultiLinkDocument.xml')
untangler: UnTangler = UnTangler(XmlVersion.V10)

untangler.untangleFile(fqFileName=fqFileName)
Expand Down
Loading

0 comments on commit 03748b6

Please sign in to comment.