added missing rules

This commit is contained in:
Benoît Sierro
2023-08-15 14:36:37 +02:00
parent aa821eb52d
commit 349c56d8f3
4 changed files with 48 additions and 33 deletions

View File

@@ -36,7 +36,7 @@ def test_simple():
assert evaluator.compute("w0") == pytest.approx(units.nm(800))
def test_default_args():
def test_default_args_simple():
def some_function(a: int, b: int, c: int = 5):
return a + b + c
@@ -51,3 +51,19 @@ def test_default_args():
evaluator.set(c=10)
assert evaluator.compute("c") == 10
assert evaluator.compute("d") == 14
def test_default_args_real():
evaluator = Evaluator.default()
evaluator.set(
wavelength=1050e-9,
peak_power=5000,
width=1500e-15,
wavelength_window=(800e-9, 1500e-9),
t_num=2048,
)
assert evaluator.compute("dt") == pytest.approx(math.dt_from_min_wl(800e-9, 1050e-9), abs=0)
assert evaluator.compute("t") == pytest.approx(
math.tspace(t_num=2048, dt=evaluator.compute("dt")), abs=0
)