@@ -1066,6 +1066,34 @@ def test_properties_cardinality(self):
1066
1066
# Use general method to reduce redundancy
1067
1067
self ._test_cardinality_re_assignment (sec , 'prop_cardinality' )
1068
1068
1069
+ def test_sections_cardinality (self ):
1070
+ """
1071
+ Tests the basic assignment rules for Section sections cardinality
1072
+ on init and re-assignment but does not test sections assignment or
1073
+ the actual cardinality validation.
1074
+ """
1075
+ doc = Document ()
1076
+
1077
+ # -- Test set cardinality on Section init
1078
+ # Test empty init
1079
+ sec_card_none = Section (name = "sec_cardinality_none" , type = "test" , parent = doc )
1080
+ self .assertIsNone (sec_card_none .sec_cardinality )
1081
+
1082
+ # Test single int max init
1083
+ sec_card_max = Section (name = "sec_cardinality_max" , sec_cardinality = 10 , parent = doc )
1084
+ self .assertEqual (sec_card_max .sec_cardinality , (None , 10 ))
1085
+
1086
+ # Test tuple init
1087
+ sec_card_min = Section (name = "sec_cardinality_min" , sec_cardinality = (2 , None ), parent = doc )
1088
+ self .assertEqual (sec_card_min .sec_cardinality , (2 , None ))
1089
+
1090
+ # -- Test Section properties cardinality re-assignment
1091
+ sec = Section (name = "sec" , sec_cardinality = (None , 10 ), parent = doc )
1092
+ self .assertEqual (sec .sec_cardinality , (None , 10 ))
1093
+
1094
+ # Use general method to reduce redundancy
1095
+ self ._test_cardinality_re_assignment (sec , 'sec_cardinality' )
1096
+
1069
1097
def _test_set_cardinality_method (self , obj , obj_attribute , set_cardinality_method ):
1070
1098
"""
1071
1099
Tests the basic set convenience method of both Section properties and
@@ -1119,6 +1147,13 @@ def test_set_properties_cardinality(self):
1119
1147
# Use general method to reduce redundancy
1120
1148
self ._test_set_cardinality_method (sec , 'prop_cardinality' , sec .set_properties_cardinality )
1121
1149
1150
+ def test_set_sections_cardinality (self ):
1151
+ doc = Document ()
1152
+ sec = Section (name = "sec" , type = "test" , parent = doc )
1153
+
1154
+ # Use general method to reduce redundancy
1155
+ self ._test_set_cardinality_method (sec , 'sec_cardinality' , sec .set_sections_cardinality )
1156
+
1122
1157
def test_link (self ):
1123
1158
pass
1124
1159
0 commit comments