-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
48 lines (34 loc) · 1.3 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from flojoy_cloud import test_sequencer
import pandas as pd
def test_min_max():
value = 6.15
test_sequencer.export(value)
assert test_sequencer.is_in_range(value)
def test_min():
value = 6.15
# If not Max value is defined, the value will be checked against the Min value.
test_sequencer.export(value)
assert test_sequencer.is_in_range(value)
def test_max():
value = 6.15
test_sequencer.export(value)
assert test_sequencer.is_in_range(value)
# If multiple assert statements are defined and one of them fails:
# - the rest of the assert statements will not be executed, and the result will
# be reported to the sequencer.
# - the sequencer will report the error, and the test will be marked as failed.
assert 0 < value
def test_export_dataframe():
df = pd.DataFrame({"value": [6.15, 6.15, 6.15]})
# Boolean and DataFrame values will be exported to the Cloud.
test_sequencer.export(df)
assert df is not None
def test_export():
value = 6.15
# Always export as early as possible to avoid missing data.
test_sequencer.export(value)
assert 12 < value # <-- FAIL
# Only the last executed export statement will be exported to the Cloud and
# reported to the sequencer.
test_sequencer.export(20)
assert 0 < value