Skip to content

Commit a535336

Browse files
committed
chore(internal): improve internal test helper (#16)
1 parent 3c7b4dd commit a535336

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/finch/_qs.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def __init__(
3434
self.nested_format = nested_format
3535

3636
def parse(self, query: str) -> Mapping[str, object]:
37-
# TODO
37+
# Note: custom format syntax is not supported yet
3838
return parse_qs(query)
3939

4040
def stringify(
@@ -89,9 +89,11 @@ def _stringify_item(
8989
if isinstance(value, (list, tuple)):
9090
array_format = opts.array_format
9191
if array_format == "comma":
92-
# TODO: support list of objects?
9392
return [
94-
(key, ",".join(self._primitive_value_to_str(item) for item in value if item is not None)),
93+
(
94+
key,
95+
",".join(self._primitive_value_to_str(item) for item in value if item is not None),
96+
),
9597
]
9698
elif array_format == "repeat":
9799
items = []

tests/utils.py

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ def assert_matches_model(model: type[BaseModelT], value: BaseModelT, *, path: li
2525

2626
# Note: the `path` argument is only used to improve error messages when `--showlocals` is used
2727
def assert_matches_type(type_: Any, value: object, *, path: list[str]) -> None:
28+
if type_ is None:
29+
assert value is None
30+
return
31+
2832
origin = get_origin(type_) or type_
2933

3034
if is_list_type(type_):

0 commit comments

Comments
 (0)