Skip to content

Commit

Permalink
Replace deprecated json method in test_model_api
Browse files Browse the repository at this point in the history
  • Loading branch information
nanglo123 committed Sep 12, 2024
1 parent 7f74f00 commit 854d614
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/test_model_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ def test_petri(self):

def test_petri_parameterized(self):
response = self.client.post(
"/api/to_petrinet_acsets", json=json.loads(sir_parameterized.json())
"/api/to_petrinet_acsets", json=json.loads(
sir_parameterized.model_dump_json())
)
self.assertEqual(200, response.status_code, msg=response.content)

Expand All @@ -163,7 +164,8 @@ def test_petri_distribution(self):
parameters={'minimum': 0.01, 'maximum': 0.5})
sir_distribution.parameters['beta'].distribution = distr
response = self.client.post(
"/api/to_petrinet_acsets", json=json.loads(sir_distribution.json())
"/api/to_petrinet_acsets", json=json.loads(
sir_distribution.model_dump_json())
)
pm = response.json()
assert (pm['T'][0]['tprop']['parameter_distribution'] ==
Expand Down Expand Up @@ -209,7 +211,8 @@ def test_askenet_to_template_model_no_sympy(self):
self.assertIsInstance(template_model, TemplateModel)

def test_askenet_from_template_model(self):
response = self.client.post("/api/to_petrinet", json=json.loads(sir_parameterized.json()))
response = self.client.post("/api/to_petrinet", json=json.loads(
sir_parameterized.model_dump_json()))
self.assertEqual(200, response.status_code, msg=response.content)
template_model = template_model_from_amr_json(response.json())
self.assertIsInstance(template_model, TemplateModel)
Expand Down Expand Up @@ -609,7 +612,7 @@ def test_counts_to_dimensionless_mira(self):
response = self.client.post(
"/api/counts_to_dimensionless_mira",
json={
"model": json.loads(sir_parameterized_init.json()),
"model": json.loads(sir_parameterized_init.model_dump_json()),
"counts_unit": "person",
"norm_factor": sir_init_val_norm,
},
Expand Down

0 comments on commit 854d614

Please sign in to comment.