@@ -27,8 +27,8 @@ def test_inspect_module_should_find_static_and_instance_attributes():
2727 coordinates_umlitem : UmlClass = domain_items_by_fqn ['tests.modules.withconstructor.Coordinates' ]
2828 assert len (coordinates_umlitem .attributes ) == 2 , '2 attributes of Coordinates must be inspected'
2929 x_attribute , y_attribute = coordinates_umlitem .attributes
30- assert_attribute (x_attribute , 'x' , 'float' , False )
31- assert_attribute (y_attribute , 'y' , 'float' , False )
30+ assert_attribute (x_attribute , 'x' , 'float' , expected_staticity = False )
31+ assert_attribute (y_attribute , 'y' , 'float' , expected_staticity = False )
3232
3333 # Point UmlClass
3434 point_umlitem : UmlClass = domain_items_by_fqn ['tests.modules.withconstructor.Point' ]
@@ -57,7 +57,7 @@ def test_inspect_module_should_find_static_and_instance_attributes():
5757 if attribute .name == attribute_name
5858 ), None )
5959 assert point_attribute is not None , f'attribute { attribute_name } must be detected'
60- assert_attribute (point_attribute , attribute_name , atrribute_type , attribute_staticity )
60+ assert_attribute (point_attribute , attribute_name , atrribute_type , expected_staticity = attribute_staticity )
6161
6262 # Coordinates is a component of Point
6363 assert len (domain_relations ) == 1 , '1 composition'
@@ -67,3 +67,39 @@ def test_inspect_module_should_find_static_and_instance_attributes():
6767 'tests.modules.withconstructor.Coordinates' ,
6868 RelType .COMPOSITION
6969 )
70+
71+ def test_inspect_module_parse_class_constructor_should_not_process_inherited_constructor ():
72+ domain_items_by_fqn : Dict [str , UmlItem ] = {}
73+ domain_relations : List [UmlRelation ] = []
74+ # inspects the two sub-modules
75+ inspect_module (
76+ import_module ('tests.modules.withinheritedconstructor.point' ),
77+ 'tests.modules.withinheritedconstructor.point' ,
78+ domain_items_by_fqn , domain_relations
79+ )
80+ inspect_module (
81+ import_module ('tests.modules.withinheritedconstructor.metricorigin' ),
82+ 'tests.modules.withinheritedconstructor.metricorigin' ,
83+ domain_items_by_fqn , domain_relations
84+ )
85+
86+ assert len (domain_items_by_fqn ) == 3 , 'three classes must be inspected'
87+
88+ # Point UmlClass
89+ point_umlitem : UmlClass = domain_items_by_fqn ['tests.modules.withinheritedconstructor.point.Point' ]
90+ assert len (point_umlitem .attributes ) == 2 , '2 attributes of Point must be inspected'
91+ x_attribute , y_attribute = point_umlitem .attributes
92+ assert_attribute (x_attribute , 'x' , 'float' , expected_staticity = False )
93+ assert_attribute (y_attribute , 'y' , 'float' , expected_staticity = False )
94+
95+ # Origin UmlClass
96+ origin_umlitem : UmlClass = domain_items_by_fqn ['tests.modules.withinheritedconstructor.point.Origin' ]
97+ assert len (origin_umlitem .attributes ) == 1 , '1 attribute of Origin must be inspected'
98+ is_origin_attribute = origin_umlitem .attributes [0 ]
99+ assert_attribute (is_origin_attribute , 'is_origin' , 'bool' , expected_staticity = True )
100+
101+ # MetricOrigin UmlClass
102+ metric_origin_umlitem : UmlClass = domain_items_by_fqn ['tests.modules.withinheritedconstructor.metricorigin.MetricOrigin' ]
103+ assert len (metric_origin_umlitem .attributes ) == 1 , '1 attribute of MetricOrigin must be inspected'
104+ unit_attribute = metric_origin_umlitem .attributes [0 ]
105+ assert_attribute (unit_attribute , 'unit' , 'str' , expected_staticity = True )
0 commit comments