Skip to content

Commit

Permalink
Validate use of Python 3.12 (#67)
Browse files Browse the repository at this point in the history
Validated the use of Python 3.12.
  • Loading branch information
twallema authored May 11, 2024
1 parent b89174e commit dd58620
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
- defaults
dependencies:
- python=3.11
- python=3.12
- pandas
- numpy
- scipy
Expand Down
10 changes: 6 additions & 4 deletions src/tests/test_JumpProcess.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_SIR_time():
output = model.sim(time)

# 'time' present in output
assert 'time' in list(output.dims.keys())
assert 'time' in list(output.sizes.keys())
# Default (no specification output frequency): 0, 1, 2, 3, ..., 50
np.testing.assert_allclose(output["time"], np.arange(0, 51))
# Numerically speaking everything ok?
Expand Down Expand Up @@ -89,6 +89,8 @@ def test_SIR_time():
with pytest.raises(TypeError, match="solver method 'method' must be of type string"):
model.sim(50, method=3)

test_SIR_time()

def test_SIR_date():
""" Test the use of str/datetime time indexing
"""
Expand All @@ -104,7 +106,7 @@ def test_SIR_date():
output = model.sim([pd.Timestamp('2020-01-01'), pd.Timestamp('2020-02-20')])

# Validate
assert 'date' in list(output.dims.keys())
assert 'date' in list(output.sizes.keys())
S = output["S"].values.squeeze()
assert S[0] == 1_000_000 - 10
assert S.shape == (51, )
Expand Down Expand Up @@ -141,7 +143,7 @@ def test_SSA():
output = model.sim([pd.Timestamp('2020-01-01'), pd.Timestamp('2020-02-20')], method='SSA')

# Validate
assert 'date' in list(output.dims.keys())
assert 'date' in list(output.sizes.keys())
S = output["S"].values.squeeze()
assert S[0] == 1000 - 10
assert S.shape == (51, )
Expand Down Expand Up @@ -517,7 +519,7 @@ def draw_function(param_dict, samples_dict):
output = model.sim(time, draw_function=draw_function, samples={}, N=5)

# assert dimension 'draws' is present in output
assert 'draws' in list(output.dims.keys())
assert 'draws' in list(output.sizes.keys())

# wrong draw function
def draw_function(pardict, samples):
Expand Down
8 changes: 4 additions & 4 deletions src/tests/test_ODE.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_SIR_time():
output = model.sim(time)

# 'time' present in output
assert 'time' in list(output.dims.keys())
assert 'time' in list(output.sizes.keys())
# Default (no specification output frequency): 0, 1, 2, 3, ..., 50
np.testing.assert_allclose(output["time"], np.arange(0, 51))
# Numerically speaking everything ok?
Expand Down Expand Up @@ -93,7 +93,7 @@ def test_SIR_date():
output = model.sim([pd.Timestamp('2020-01-01'), pd.Timestamp('2020-02-20')])

# Validate
assert 'date' in list(output.dims.keys())
assert 'date' in list(output.sizes.keys())
S = output["S"].values.squeeze()
assert S[0] == 1_000_000 - 10
assert S.shape == (51, )
Expand Down Expand Up @@ -131,7 +131,7 @@ def test_SIR_discrete_stepper():
# Simulate model
output = model.sim(50, tau=1)
# 'time' present in output
assert 'time' in list(output.dims.keys())
assert 'time' in list(output.sizes.keys())
# Default (no specification output frequency): 0, 1, 2, 3, ..., 50
np.testing.assert_allclose(output["time"], np.arange(0, 51))
# Numerically speaking everything ok?
Expand Down Expand Up @@ -500,7 +500,7 @@ def draw_function(param_dict, samples_dict):
output = model.sim(time, draw_function=draw_function, samples={}, N=5)

# assert dimension 'draws' is present in output
assert 'draws' in list(output.dims.keys())
assert 'draws' in list(output.sizes.keys())

# wrong draw function
def draw_function(pardict, samples):
Expand Down

0 comments on commit dd58620

Please sign in to comment.