-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<Enhancement>[UnTangleOglLinks]: <Multi Implementor Lollipop fix>
[ * Unit Test * Unit test file ] [#78]
- Loading branch information
Humberto Sanchez II
committed
Jun 8, 2024
1 parent
5efb61d
commit 343ddb6
Showing
3 changed files
with
154 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?xml version='1.0' encoding='iso-8859-1'?> | ||
<PyutProject version="11" CodePath=""> | ||
<PyutDocument type="CLASS_DIAGRAM" title="SampleIFace" scrollPositionX="0" scrollPositionY="0" pixelsPerUnitX="20" pixelsPerUnitY="20"> | ||
<OglClass width="66" height="60" x="120" y="60"> | ||
<PyutClass id="3" name="NameA" stereotype="noStereotype" displayMethods="True" displayParameters="Unspecified" displayConstructor="Unspecified" displayDunderMethods="Unspecified" displayFields="True" displayStereotype="True" fileName="" description=""> | ||
<PyutMethod name="method" visibility="PUBLIC" returnType=""> | ||
<SourceCode /> | ||
</PyutMethod> | ||
<PyutField name="field" visibility="PRIVATE" type="" defaultValue="" /> | ||
</PyutClass> | ||
</OglClass> | ||
<OglClass width="114" height="60" x="150" y="250"> | ||
<PyutClass id="4" name="SouthLollipopClass" stereotype="noStereotype" displayMethods="True" displayParameters="Unspecified" displayConstructor="Unspecified" displayDunderMethods="Unspecified" displayFields="True" displayStereotype="True" fileName="" description=""> | ||
<PyutMethod name="method" visibility="PUBLIC" returnType=""> | ||
<SourceCode /> | ||
</PyutMethod> | ||
<PyutField name="field" visibility="PRIVATE" type="" defaultValue="" /> | ||
</PyutClass> | ||
</OglClass> | ||
<OglInterface2 attachmentPoint="WEST" x="120" y="90"> | ||
<PyutInterface id="9" name="IWest" description=""> | ||
<PyutMethod name="MethodName1" visibility="PUBLIC" returnType="int"> | ||
<SourceCode /> | ||
<PyutParameter name="parameter1" type="str" defaultValue="bogus" /> | ||
</PyutMethod> | ||
<Implementor implementingClassName="NameA" /> | ||
<Implementor implementingClassName="SouthLollipopClass" /> | ||
</PyutInterface> | ||
</OglInterface2> | ||
<OglInterface2 attachmentPoint="WEST" x="150" y="280"> | ||
<PyutInterface id="9" name="IWest" description=""> | ||
<PyutMethod name="MethodName1" visibility="PUBLIC" returnType="int"> | ||
<SourceCode /> | ||
<PyutParameter name="parameter1" type="str" defaultValue="bogus" /> | ||
</PyutMethod> | ||
<Implementor implementingClassName="NameA" /> | ||
<Implementor implementingClassName="SouthLollipopClass" /> | ||
</PyutInterface> | ||
</OglInterface2> | ||
</PyutDocument> | ||
</PyutProject> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
|
||
from typing import cast | ||
|
||
from unittest import TestSuite | ||
from unittest import main as unitTestMain | ||
|
||
from codeallybasic.UnitTestBase import UnitTestBase | ||
|
||
from pyutmodelv2.PyutInterface import PyutInterface | ||
|
||
from ogl.OglInterface2 import OglInterface2 | ||
|
||
from untanglepyut.Types import Document | ||
from untanglepyut.Types import DocumentTitle | ||
from untanglepyut.Types import Documents | ||
from untanglepyut.Types import UntangledOglLinks | ||
|
||
from untanglepyut.UnTangler import UnTangler | ||
from untanglepyut.XmlVersion import XmlVersion | ||
|
||
from tests.ProjectTestBase import TestBase | ||
|
||
|
||
class TestUnTangler(TestBase): | ||
""" | ||
Auto generated by the one and only: | ||
Gato Malo – Humberto A. Sanchez II | ||
Generated: 06 June 2024 | ||
""" | ||
|
||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
|
||
def setUp(self): | ||
super().setUp() | ||
|
||
def tearDown(self): | ||
super().tearDown() | ||
|
||
def testLollipopInterfaceMultiImplementor(self): | ||
|
||
fqFileName: str = UnitTestBase.getFullyQualifiedResourceFileName(package=TestBase.V11_TEST_FILES_PACKAGE_NAME, | ||
fileName='LollipopInterfaceMultiImplementor.xml') | ||
untangler: UnTangler = UnTangler(xmlVersion=XmlVersion.V11) | ||
|
||
untangler.untangleFile(fqFileName=fqFileName) | ||
|
||
documents: Documents = untangler.documents | ||
|
||
self.assertTrue(len(documents) == 1, 'Should only have a single document') | ||
|
||
document: Document = documents[DocumentTitle('SampleIFace')] | ||
|
||
untangledOglLinks: UntangledOglLinks = document.oglLinks | ||
|
||
self.assertTrue(len(untangledOglLinks) == 2, 'Not enough lollipops') | ||
|
||
interface1: OglInterface2 = cast(OglInterface2, untangledOglLinks[0]) | ||
interface2: OglInterface2 = cast(OglInterface2, untangledOglLinks[1]) | ||
|
||
pyutInterface1: PyutInterface = interface1.pyutInterface | ||
pyutInterface2: PyutInterface = interface2.pyutInterface | ||
|
||
self.assertEqual(pyutInterface1.name, pyutInterface2.name, 'Names should match') | ||
self.assertEqual(pyutInterface1.id, pyutInterface2.id, 'IDs should match') | ||
|
||
|
||
def suite() -> TestSuite: | ||
import unittest | ||
|
||
testSuite: TestSuite = TestSuite() | ||
|
||
testSuite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(testCaseClass=TestUnTangler)) | ||
|
||
return testSuite | ||
|
||
|
||
if __name__ == '__main__': | ||
unitTestMain() |