2525
2626class TestSelectValue :
2727 def test_select_value_codeable_concept (self ):
28- cc = CodeableConcept .construct ()
29- elem = Extension .construct (valueCodeableConcept = cc )
28+ cc = CodeableConcept .model_construct ()
29+ elem = Extension .model_construct (valueCodeableConcept = cc )
3030 value = select_value (elem , "value" )
3131 assert value == cc
3232
3333 def test_select_value_quantity (self ):
34- q = Quantity .construct ()
35- elem = Extension .construct (valueQuantity = q )
34+ q = Quantity .model_construct ()
35+ elem = Extension .model_construct (valueQuantity = q )
3636 value = select_value (elem , "value" )
3737 assert value == q
3838
3939 def test_select_value_range (self ):
40- r = Range .construct ()
41- elem = Extension .construct (valueRange = r )
40+ r = Range .model_construct ()
41+ elem = Extension .model_construct (valueRange = r )
4242 value = select_value (elem , "value" )
4343 assert value == r
4444
4545 def test_select_value_boolean (self ):
4646 b = True
47- elem = Extension .construct (valueBoolean = b )
47+ elem = Extension .model_construct (valueBoolean = b )
4848 value = select_value (elem , "value" )
4949 assert value == b
5050
5151 def test_select_value_not_found (self ):
52- elem = Extension .construct ()
52+ elem = Extension .model_construct ()
5353 with pytest .raises (ValueError ):
5454 select_value (elem , "value" )
5555
@@ -62,25 +62,25 @@ def test_parse_code(self, monkeypatch):
6262 mock_get_standard_concept ,
6363 )
6464
65- coding = Coding .construct (system = "http://example.com" , code = "123" )
66- codeable_concept = CodeableConcept .construct (coding = [coding ])
65+ coding = Coding .model_construct (system = "http://example.com" , code = "123" )
66+ codeable_concept = CodeableConcept .model_construct (coding = [coding ])
6767 parse_code (codeable_concept )
6868
6969 mock_get_standard_concept .assert_called_once_with ("http://example.com" , "123" )
7070
7171
7272class TestCodeDisplay :
7373 def test_code_display_with_display (self ):
74- coding = Coding .construct (
74+ coding = Coding .model_construct (
7575 system = "http://example.com" , code = "123" , display = "Example display"
7676 )
77- codeable_concept = CodeableConcept .construct (coding = [coding ])
77+ codeable_concept = CodeableConcept .model_construct (coding = [coding ])
7878 display = code_display (codeable_concept )
7979 assert display == "Example display"
8080
8181 def test_code_display_without_display (self ):
82- coding = Coding .construct (system = "http://example.com" , code = "123" )
83- codeable_concept = CodeableConcept .construct (coding = [coding ])
82+ coding = Coding .model_construct (system = "http://example.com" , code = "123" )
83+ codeable_concept = CodeableConcept .model_construct (coding = [coding ])
8484 display = code_display (codeable_concept )
8585 assert display == "123"
8686
@@ -94,9 +94,9 @@ def test_parse_value_codeable_concept(self, monkeypatch, test_concept):
9494 mock_get_standard_concept ,
9595 )
9696
97- coding = Coding .construct (system = "http://example.com" , code = "123" )
98- codeable_concept = CodeableConcept .construct (coding = [coding ])
99- elem = Extension .construct (valueCodeableConcept = codeable_concept )
97+ coding = Coding .model_construct (system = "http://example.com" , code = "123" )
98+ codeable_concept = CodeableConcept .model_construct (coding = [coding ])
99+ elem = Extension .model_construct (valueCodeableConcept = codeable_concept )
100100
101101 value = parse_value (elem , "value" )
102102
@@ -113,8 +113,8 @@ def test_parse_value_quantity(self, monkeypatch, unit_concept):
113113 mock_get_standard_unit_concept ,
114114 )
115115
116- quantity = Quantity .construct (value = 42 , code = "kg" )
117- elem = Extension .construct (valueQuantity = quantity )
116+ quantity = Quantity .model_construct (value = 42 , code = "kg" )
117+ elem = Extension .model_construct (valueQuantity = quantity )
118118
119119 value = parse_value (elem , "value" )
120120
@@ -130,10 +130,10 @@ def test_parse_value_range(self, monkeypatch, unit_concept):
130130 mock_get_standard_unit_concept ,
131131 )
132132
133- low = Quantity .construct (value = 10 , code = "kg" )
134- high = Quantity .construct (value = 20 , code = "kg" )
135- range_obj = Range .construct (low = low , high = high )
136- elem = Extension .construct (valueRange = range_obj )
133+ low = Quantity .model_construct (value = 10 , code = "kg" )
134+ high = Quantity .model_construct (value = 20 , code = "kg" )
135+ range_obj = Range .model_construct (low = low , high = high )
136+ elem = Extension .model_construct (valueRange = range_obj )
137137
138138 value = parse_value (elem , "value" )
139139
@@ -170,7 +170,7 @@ def test_criterion_converter_factory_get(self):
170170 factory = CriterionConverterFactory ()
171171 factory .register (TestCriterionConverter .MockCriterionConverter )
172172
173- element = Element .construct (id = "valid" )
173+ element = Element .model_construct (id = "valid" )
174174 converter = factory .get (element )
175175
176176 assert isinstance (
@@ -181,7 +181,7 @@ def test_criterion_converter_factory_no_matching_converter(self):
181181 factory = CriterionConverterFactory ()
182182 factory .register (TestCriterionConverter .MockCriterionConverter )
183183
184- element = Element .construct (id = "not-valid" )
184+ element = Element .model_construct (id = "not-valid" )
185185
186186 with pytest .raises (ValueError , match = "Cannot find a converter" ):
187187 factory .get (element )
0 commit comments