Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p committed May 7, 2021
1 parent 9df6c76 commit 3c92cc3
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 27 deletions.
54 changes: 33 additions & 21 deletions tests/data/empty_lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,23 +123,31 @@ def f():
return NO

if prevp.type == token.EQUAL:
if prevp.parent and prevp.parent.type in {
syms.typedargslist,
syms.varargslist,
syms.parameters,
syms.arglist,
syms.argument,
}:
if (
prevp.parent
and prevp.parent.type
in {
syms.typedargslist,
syms.varargslist,
syms.parameters,
syms.arglist,
syms.argument,
}
):
return NO

elif prevp.type == token.DOUBLESTAR:
if prevp.parent and prevp.parent.type in {
syms.typedargslist,
syms.varargslist,
syms.parameters,
syms.arglist,
syms.dictsetmaker,
}:
if (
prevp.parent
and prevp.parent.type
in {
syms.typedargslist,
syms.varargslist,
syms.parameters,
syms.arglist,
syms.dictsetmaker,
}
):
return NO


Expand Down Expand Up @@ -177,11 +185,15 @@ def g():
return NO

if prevp.type == token.EQUAL:
if prevp.parent and prevp.parent.type in {
syms.typedargslist,
syms.varargslist,
syms.parameters,
syms.arglist,
syms.argument,
}:
if (
prevp.parent
and prevp.parent.type
in {
syms.typedargslist,
syms.varargslist,
syms.parameters,
syms.arglist,
syms.argument,
}
):
return NO
4 changes: 2 additions & 2 deletions tests/data/expression.diff
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@
-for addr_family, addr_type, addr_proto, addr_canonname, addr_sockaddr in socket.getaddrinfo('google.com', 'http'):
+print(*lambda x: x)
+assert not Test, "Short message"
+assert this is ComplexTest and not requirements.fit_in_a_single_line(
+ force=False
+assert (
+ this is ComplexTest and not requirements.fit_in_a_single_line(force=False)
+), "Short message"
+assert parens is TooMany
+for (x,) in (1,), (2,), (3,):
Expand Down
4 changes: 2 additions & 2 deletions tests/data/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,8 @@ async def f():
print(**{1: 3} if False else {x: x for x in range(3)})
print(*lambda x: x)
assert not Test, "Short message"
assert this is ComplexTest and not requirements.fit_in_a_single_line(
force=False
assert (
this is ComplexTest and not requirements.fit_in_a_single_line(force=False)
), "Short message"
assert parens is TooMany
for (x,) in (1,), (2,), (3,):
Expand Down
4 changes: 2 additions & 2 deletions tests/data/expression_skip_magic_trailing_comma.diff
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@
-for addr_family, addr_type, addr_proto, addr_canonname, addr_sockaddr in socket.getaddrinfo('google.com', 'http'):
+print(*lambda x: x)
+assert not Test, "Short message"
+assert this is ComplexTest and not requirements.fit_in_a_single_line(
+ force=False
+assert (
+ this is ComplexTest and not requirements.fit_in_a_single_line(force=False)
+), "Short message"
+assert parens is TooMany
+for (x,) in (1,), (2,), (3,):
Expand Down

0 comments on commit 3c92cc3

Please sign in to comment.