Skip to content

Commit ab0dabc

Browse files
test: Fix json_set error tests to create resources in test body (#845)
1 parent ed06436 commit ab0dabc

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed

tests/system/small/bigquery/test_json.py

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -85,35 +85,28 @@ def test_json_set_w_more_pairs():
8585
)
8686

8787

88-
@pytest.mark.parametrize(
89-
("series", "json_path_value_pairs"),
90-
[
91-
pytest.param(
92-
_get_series_from_json([{"a": 10}]),
93-
[("$.a", 1, 100)],
94-
id="invalid_json_path_value_pairs",
95-
marks=pytest.mark.xfail(raises=ValueError),
96-
),
97-
pytest.param(
88+
def test_json_set_w_invalid_json_path_value_pairs():
89+
with pytest.raises(ValueError):
90+
bbq.json_set(
91+
_get_series_from_json([{"a": 10}]), json_path_value_pairs=[("$.a", 1, 100)] # type: ignore
92+
)
93+
94+
95+
def test_json_set_w_invalid_value_type():
96+
with pytest.raises(TypeError):
97+
bbq.json_set(
9898
_get_series_from_json([{"a": 10}]),
99-
[
99+
json_path_value_pairs=[
100100
(
101101
"$.a",
102102
bpd.read_pandas(
103103
gpd.GeoSeries.from_wkt(["POINT (1 2)", "POINT (2 1)"])
104104
),
105105
)
106106
],
107-
id="invalid_json_value_type",
108-
marks=pytest.mark.xfail(raises=TypeError),
109-
),
110-
pytest.param(
111-
bpd.Series([1, 2]),
112-
[("$.a", 1)],
113-
id="invalid_series_type",
114-
marks=pytest.mark.xfail(raises=TypeError),
115-
),
116-
],
117-
)
118-
def test_json_set_w_invalid(series, json_path_value_pairs):
119-
bbq.json_set(series, json_path_value_pairs=json_path_value_pairs)
107+
)
108+
109+
110+
def test_json_set_w_invalid_series_type():
111+
with pytest.raises(TypeError):
112+
bbq.json_set(bpd.Series([1, 2]), json_path_value_pairs=[("$.a", 1)])

0 commit comments

Comments
 (0)