Skip to content

Commit

Permalink
fix: removed assertion for positional arguments (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
15r10nk authored Jan 15, 2025
1 parent c6bfced commit 4064eea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Fixed

- raise no assertion for positional arguments inside constructor methods.
1 change: 0 additions & 1 deletion src/inline_snapshot/_adapter/generic_call_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ def items(cls, value, node):

if node is not None:
assert isinstance(node, ast.Call)
assert not node.args
assert all(kw.arg for kw in node.keywords)
kw_arg_node = {kw.arg: kw.value for kw in node.keywords if kw.arg}.get
pos_arg_node = lambda pos: node.args[pos]
Expand Down
6 changes: 4 additions & 2 deletions tests/test_pydantic.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ def from_str(cls,s):
return cls(a=int(s))
def test_something():
assert A(a=2) == snapshot(A.from_str("1"))
for a in [1,2]:
assert A(a=2) == snapshot(A.from_str("1"))
"""
).run_pytest(
["--inline-snapshot=fix"],
Expand All @@ -169,7 +170,8 @@ def from_str(cls,s):
return cls(a=int(s))
def test_something():
assert A(a=2) == snapshot(A(a=2))
for a in [1,2]:
assert A(a=2) == snapshot(A(a=2))
"""
}
),
Expand Down

0 comments on commit 4064eea

Please sign in to comment.