Skip to content

Commit 4813d7b

Browse files
committed
fixes
1 parent 14d55e3 commit 4813d7b

File tree

1 file changed

+21
-23
lines changed

1 file changed

+21
-23
lines changed

tests/test_internal.py

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -61,25 +61,24 @@ def test_escape_multi_segment_path_parameter():
6161

6262

6363
@pytest.mark.parametrize(
64-
"input_dict,field_name,expected_result,expected_timestamp,description",
64+
"input_dict,field_name,expected_timestamp,description",
6565
[
6666
(
6767
{"field": "2023-01-01T12:00:00Z"},
6868
"field",
69-
"timestamp_object",
7069
Timestamp(seconds=1672574400),
7170
"valid timestamp",
7271
),
73-
({}, "field", None, None, "missing field"),
74-
({"field": None}, "field", None, None, "None value"),
75-
({"field": ""}, "field", None, None, "empty value"),
72+
({}, "field", None, "missing field"),
73+
({"field": None}, "field", None, "None value"),
74+
({"field": ""}, "field", None, "empty value"),
7675
],
7776
)
78-
def test_timestamp(input_dict, field_name, expected_result, expected_timestamp, description):
77+
def test_timestamp(input_dict, field_name, expected_timestamp, description):
7978
"""Test _timestamp function with various input scenarios."""
8079
result = _timestamp(input_dict, field_name)
8180

82-
if expected_result is None:
81+
if expected_timestamp is None:
8382
assert result is None
8483
else:
8584
assert isinstance(result, Timestamp)
@@ -96,7 +95,7 @@ def test_timestamp(input_dict, field_name, expected_result, expected_timestamp,
9695
"valid repeated timestamps",
9796
),
9897
({}, "field", [], "missing field"),
99-
({"field": None}, "field", None, "None value"),
98+
({"field": None}, "field", [], "None value"),
10099
({"field": []}, "field", [], "empty list"),
101100
],
102101
)
@@ -114,19 +113,19 @@ def test_repeated_timestamp(input_dict, field_name, expected_timestamp_list, des
114113

115114

116115
@pytest.mark.parametrize(
117-
"input_dict,field_name,expected_result,expected_duration,description",
116+
"input_dict,field_name,expected_duration,description",
118117
[
119-
({"field": "3600s"}, "field", "duration_object", Duration(seconds=3600), "valid duration"),
120-
({}, "field", None, None, "missing field"),
121-
({"field": None}, "field", None, None, "None value"),
122-
({"field": ""}, "field", None, None, "empty value"),
118+
({"field": "3600s"}, "field", Duration(seconds=3600), "valid duration"),
119+
({}, "field", None, "missing field"),
120+
({"field": None}, "field", None, "None value"),
121+
({"field": ""}, "field", None, "empty value"),
123122
],
124123
)
125-
def test_duration(input_dict, field_name, expected_result, expected_duration, description):
124+
def test_duration(input_dict, field_name, expected_duration, description):
126125
"""Test _duration function with various input scenarios."""
127126
result = _duration(input_dict, field_name)
128127

129-
if expected_result is None:
128+
if expected_duration is None:
130129
assert result is None
131130
else:
132131
assert isinstance(result, Duration)
@@ -161,25 +160,24 @@ def test_repeated_duration(input_dict, field_name, expected_duration_list, descr
161160

162161

163162
@pytest.mark.parametrize(
164-
"input_dict,field_name,expected_result,expected_fieldmask,description",
163+
"input_dict,field_name,expected_fieldmask,description",
165164
[
166165
(
167166
{"field": "path1,path2"},
168-
"field",
169-
"fieldmask_object",
167+
"field",
170168
FieldMask(field_mask=["path1", "path2"]),
171169
"valid fieldmask",
172170
),
173-
({}, "field", None, None, "missing field"),
174-
({"field": None}, "field", None, None, "None value"),
175-
({"field": ""}, "field", None, None, "empty value"),
171+
({}, "field", None, "missing field"),
172+
({"field": None}, "field", None, "None value"),
173+
({"field": ""}, "field", None, "empty value"),
176174
],
177175
)
178-
def test_fieldmask(input_dict, field_name, expected_result, expected_fieldmask, description):
176+
def test_fieldmask(input_dict, field_name, expected_fieldmask, description):
179177
"""Test _fieldmask function with various input scenarios."""
180178
result = _fieldmask(input_dict, field_name)
181179

182-
if expected_result is None:
180+
if expected_fieldmask is None:
183181
assert result is None
184182
else:
185183
assert isinstance(result, FieldMask)

0 commit comments

Comments
 (0)