Skip to content

Commit e77b7e6

Browse files
committed
Add Discrete interpolation tests
1 parent 63b0c56 commit e77b7e6

File tree

4 files changed

+39
-4
lines changed

4 files changed

+39
-4
lines changed

tests/main/tbool_test.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,13 @@ def test_gaps_constructor(self, params, result):
290290
[
291291
{"interpolation": TInterpolation.STEPWISE, "max_distance": 2},
292292
{"interpolation": TInterpolation.LINEAR},
293+
{"interpolation": TInterpolation.DISCRETE},
294+
],
295+
ids=[
296+
"Max Distance",
297+
"Linear Interpolation",
298+
"Discrete Interpolation",
293299
],
294-
ids=["Max Distance", "Linear Interpolation"],
295300
)
296301
def test_gaps_constructor_with_invalid_parameters_raises(self, params):
297302
instants = [

tests/main/tfloat_test.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,24 @@ def test_instant_list_sequence_constructor(
389389
def test_gaps_constructor(self, params, result):
390390
assert TFloatSeqSet.from_instants_with_gaps(*params) == result
391391

392+
@pytest.mark.parametrize(
393+
"params",
394+
[
395+
{"interpolation": TInterpolation.DISCRETE},
396+
],
397+
ids=[
398+
"Discrete Interpolation",
399+
],
400+
)
401+
def test_gaps_constructor_with_invalid_parameters_raises(self, params):
402+
instants = [
403+
TFloatInst(value=1, timestamp="2000-01-01"),
404+
TFloatInst(value=5, timestamp="2000-01-02"),
405+
TFloatInst(value=6, timestamp="2000-01-03"),
406+
]
407+
with pytest.raises(MeosException):
408+
TFloatSeqSet.from_instants_with_gaps(instants, **params)
409+
392410
@pytest.mark.parametrize(
393411
"temporal",
394412
[tfi, tfds, tfs, tfss, tfsts, tfstss],

tests/main/tint_test.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,14 +322,25 @@ def test_instant_list_sequence_constructor(
322322
def test_gaps_constructor(self, params, result):
323323
assert TIntSeqSet.from_instants_with_gaps(*params) == result
324324

325-
def test_gaps_constructor_with_invalid_parameters_raises(self):
325+
@pytest.mark.parametrize(
326+
"params",
327+
[
328+
{"interpolation": TInterpolation.LINEAR},
329+
{"interpolation": TInterpolation.DISCRETE},
330+
],
331+
ids=[
332+
"Linear Interpolation",
333+
"Discrete Interpolation",
334+
],
335+
)
336+
def test_gaps_constructor_with_invalid_parameters_raises(self, params):
326337
instants = [
327338
TIntInst(value=1, timestamp="2000-01-01"),
328339
TIntInst(value=5, timestamp="2000-01-02"),
329340
TIntInst(value=6, timestamp="2000-01-03"),
330341
]
331342
with pytest.raises(MeosException):
332-
TIntSeqSet.from_instants_with_gaps(instants, TInterpolation.LINEAR)
343+
TIntSeqSet.from_instants_with_gaps(instants, **params)
333344

334345
@pytest.mark.parametrize(
335346
"temporal",

tests/main/ttext_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,9 @@ def test_gaps_constructor(self, params, result):
293293
[
294294
{"interpolation": TInterpolation.STEPWISE, "max_distance": 2},
295295
{"interpolation": TInterpolation.LINEAR},
296+
{"interpolation": TInterpolation.DISCRETE},
296297
],
297-
ids=["Max Distance", "Linear Interpolation"],
298+
ids=["Max Distance", "Linear Interpolation", "Discrete Interpolation"],
298299
)
299300
def test_gaps_constructor_with_invalid_parameters_raises(self, params):
300301
instants = [

0 commit comments

Comments
 (0)