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

Function test_json_get_default

python/pathway/tests/test_json.py:85–121  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

83
84
85def test_json_get_default():
86 input = _json_table(
87 data=[
88 {"a": {"b": 1}},
89 {"a": {"b": None}},
90 {"a": {}},
91 {"a": [1, 2, 3]},
92 {"a": 42},
93 {"a": None},
94 {},
95 [1, 2, 3],
96 None,
97 1,
98 "foo",
99 ]
100 )
101
102 result = input.select(result=pw.this.data.get("a", default={"b": 42}))
103
104 assert_table_equality(
105 _json_table(
106 result=[
107 {"b": 1},
108 {"b": None},
109 {},
110 [1, 2, 3],
111 42,
112 None,
113 {"b": 42},
114 {"b": 42},
115 {"b": 42},
116 {"b": 42},
117 {"b": 42},
118 ]
119 ),
120 result,
121 )
122
123
124def test_json_get_wo_default():

Callers

nothing calls this directly

Calls 3

_json_tableFunction · 0.85
selectMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected