MCPcopy Index your code
hub / github.com/pathwaycom/pathway / test_division_by_zero

Function test_division_by_zero

python/pathway/tests/test_errors.py:36–74  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34
35
36def test_division_by_zero():
37 t1 = T(
38 """
39 a | b | c
40 3 | 3 | 1
41 4 | 0 | 2
42 5 | 5 | 0
43 6 | 2 | 3
44 """
45 )
46
47 t2 = t1.select(x=pw.this.a // pw.this.b)
48 t3 = t1.select(y=pw.this.a // pw.this.c)
49
50 t4 = t1.select(pw.this.a, x=pw.fill_error(t2.x, -1), y=pw.fill_error(t3.y, -1))
51
52 expected = T(
53 """
54 a | x | y
55 3 | 1 | 3
56 4 | -1 | 2
57 5 | 1 | -1
58 6 | 3 | 2
59 """
60 )
61 expected_errors = T(
62 """
63 message | line
64 division by zero | t2 = t1.select(x=pw.this.a // pw.this.b)
65 division by zero | t3 = t1.select(y=pw.this.a // pw.this.c)
66 """,
67 split_on_whitespace=False,
68 )
69
70 assert_table_equality_wo_index(
71 (t4, global_errors()),
72 (expected, expected_errors),
73 terminate_on_error=False,
74 )
75
76
77def test_removal_of_error():

Callers

nothing calls this directly

Calls 3

TFunction · 0.90
global_errorsFunction · 0.85
selectMethod · 0.45

Tested by

no test coverage detected