Skip to content
Permalink
Browse files

Fixed tests Pt 1:

Fixed all fixtures that failed because of the new shorter line length
  • Loading branch information...
venthur committed Aug 22, 2019
1 parent f322b60 commit b5f6ecf51adfa90751e8a7fbc139081e7f676a48
@@ -281,7 +281,9 @@ def inline_comments_in_brackets_ruin_everything():
arg3=True,
)
lcomp = [
element for element in collection if element is not None # yup # yup # right
element # yup
for element in collection # yup
if element is not None # right
]
lcomp2 = [
# hello
@@ -50,7 +50,11 @@ class C:
"https://packaging.python.org/specifications/core-metadata",
),
(
{"metadata_version": "1.2", "name": "example", "version": "dog"},
{
"metadata_version": "1.2",
"name": "example",
"version": "dog",
},
"'dog' is an invalid value for Version. "
"Error: Must start and end with a letter or numeral and "
"contain only ascii numeric and '.', '_' and '-'. "
@@ -70,7 +74,10 @@ def foo(list_a, list_b):
results = (
User.query.filter(User.foo == "bar")
.filter( # Because foo.
db.or_(User.field_a.astext.in_(list_a), User.field_b.astext.in_(list_b))
db.or_(
User.field_a.astext.in_(list_a),
User.field_b.astext.in_(list_b),
)
)
.filter(User.xyz.is_(None))
# Another comment about the filtering on is_quux goes here.
@@ -87,7 +94,10 @@ def foo2(list_a, list_b):
return (
User.query.filter(User.foo == "bar")
.filter(
db.or_(User.field_a.astext.in_(list_a), User.field_b.astext.in_(list_b))
db.or_(
User.field_a.astext.in_(list_a),
User.field_b.astext.in_(list_b),
)
)
.filter(User.xyz.is_(None))
)
@@ -98,7 +108,10 @@ def foo3(list_a, list_b):
# Standlone comment but weirdly placed.
User.query.filter(User.foo == "bar")
.filter(
db.or_(User.field_a.astext.in_(list_a), User.field_b.astext.in_(list_b))
db.or_(
User.field_a.astext.in_(list_a),
User.field_b.astext.in_(list_b),
)
)
.filter(User.xyz.is_(None))
)
@@ -52,7 +52,9 @@ def f(
another_really_really_long_element_with_a_unnecessarily_long_name_to_describe_what_it_does_enterprise_style = (
3
) # type: int
an_element_with_a_long_value = calls() or more_calls() and more() # type: bool
an_element_with_a_long_value = (
calls() or more_calls() and more()
) # type: bool

tup = (
another_element,
@@ -2,7 +2,8 @@ class C:
def test(self) -> None:
with patch("black.out", print):
self.assertEqual(
unstyle(str(report)), "1 file reformatted, 1 file failed to reformat."
unstyle(str(report)),
"1 file reformatted, 1 file failed to reformat.",
)
self.assertEqual(
unstyle(str(report)),
@@ -52,11 +53,12 @@ def omitting_trailers(self) -> None:
get_collection(
hey_this_is_a_very_long_call, it_has_funny_attributes, really=True
)[OneLevelIndex][TwoLevelIndex][ThreeLevelIndex][FourLevelIndex]
d[0][1][2][3][4][5][6][7][8][9][10][11][12][13][14][15][16][17][18][19][20][21][
22
]
d[0][1][2][3][4][5][6][7][8][9][10][11][12][13][14][15][16][17][18][
19
][20][21][22]
assignment = (
some.rather.elaborate.rule() and another.rule.ending_with.index[123]
some.rather.elaborate.rule()
and another.rule.ending_with.index[123]
)

def easy_asserts(self) -> None:
@@ -108,7 +110,9 @@ def tricky_asserts(self) -> None:
key8: value8,
key9: value9,
} == expected(
value, is_going_to_be="too long to fit in a single line", srsly=True
value,
is_going_to_be="too long to fit in a single line",
srsly=True,
), "Not what we expected"

assert {
@@ -121,12 +125,12 @@ def tricky_asserts(self) -> None:
key7: value7,
key8: value8,
key9: value9,
} == expected, (
"Not what we expected and the message is too long to fit in one line"
)
} == expected, "Not what we expected and the message is too long to fit in one line"

assert expected(
value, is_going_to_be="too long to fit in a single line", srsly=True
value,
is_going_to_be="too long to fit in a single line",
srsly=True,
) == {
key1: value1,
key2: value2,
@@ -166,14 +170,17 @@ def tricky_asserts(self) -> None:
_C.__init__.__code__.co_firstlineno + 1,
)

assert expectedexpectedexpectedexpectedexpectedexpectedexpectedexpectedexpect == {
key1: value1,
key2: value2,
key3: value3,
key4: value4,
key5: value5,
key6: value6,
key7: value7,
key8: value8,
key9: value9,
}
assert (
expectedexpectedexpectedexpectedexpectedexpectedexpectedexpectedexpect
== {
key1: value1,
key2: value2,
key3: value3,
key4: value4,
key5: value5,
key6: value6,
key7: value7,
key8: value8,
key9: value9,
}
)
@@ -16,7 +16,6 @@ def f():
if t == token.COMMENT: # another trailing comment
return DOUBLESPACE


assert p is not None, f"INTERNAL ERROR: hand-made leaf without parent: {leaf!r}"


@@ -113,7 +112,9 @@ def f():
if t == token.COMMENT: # another trailing comment
return DOUBLESPACE

assert p is not None, f"INTERNAL ERROR: hand-made leaf without parent: {leaf!r}"
assert (
p is not None
), f"INTERNAL ERROR: hand-made leaf without parent: {leaf!r}"

prev = leaf.prev_sibling
if not prev:
@@ -165,7 +166,9 @@ def g():
return DOUBLESPACE

# Another comment because more comments
assert p is not None, f"INTERNAL ERROR: hand-made leaf without parent: {leaf!r}"
assert (
p is not None
), f"INTERNAL ERROR: hand-made leaf without parent: {leaf!r}"

prev = leaf.prev_sibling
if not prev:
@@ -118,7 +118,7 @@
call(**self.screen_kwargs)
call(b, **self.screen_kwargs)
lukasz.langa.pl
@@ -94,23 +115,25 @@
@@ -94,23 +115,27 @@
1.0 .real
....__class__
list[str]
@@ -129,12 +129,15 @@
very_long_variable_name_filters: t.List[
t.Tuple[str, t.Union[str, t.List[t.Optional[str]]]],
]
xxxx_xxxxx_xxxx_xxx: Callable[..., List[SomeClass]] = classmethod( # type: ignore
sync(async_xxxx_xxx_xxxx_xxxxx_xxxx_xxx.__func__)
)
-xxxx_xxx_xxxx_xxxxx_xxxx_xxx: Callable[..., List[SomeClass]] = classmethod( # type: ignore
-xxxx_xxxxx_xxxx_xxx: Callable[..., List[SomeClass]] = classmethod( # type: ignore
- sync(async_xxxx_xxx_xxxx_xxxxx_xxxx_xxx.__func__)
-)
-xxxx_xxx_xxxx_xxxxx_xxxx_xxx: Callable[..., List[SomeClass]] = classmethod( # type: ignore
+xxxx_xxxxx_xxxx_xxx: Callable[
+ ..., List[SomeClass]
+] = classmethod( # type: ignore
sync(async_xxxx_xxx_xxxx_xxxxx_xxxx_xxx.__func__)
)
xxxx_xxx_xxxx_xxxxx_xxxx_xxx: Callable[
..., List[SomeClass]
-] = classmethod(sync(async_xxxx_xxx_xxxx_xxxxx_xxxx_xxx.__func__)) # type: ignore
@@ -149,7 +152,7 @@
slice[0:1:2]
slice[:]
slice[:-1]
@@ -134,113 +157,171 @@
@@ -134,113 +159,172 @@
numpy[-(c + 1) :, d]
numpy[:, l[-2]]
numpy[:, ::-1]
@@ -191,16 +194,17 @@
-what_is_up_with_those_new_coord_names = (coord_names + set(vars_to_create)) + set(vars_to_remove)
-what_is_up_with_those_new_coord_names = (coord_names | set(vars_to_create)) - set(vars_to_remove)
-result = session.query(models.Customer.id).filter(models.Customer.account_id == account_id, models.Customer.email == email_address).order_by(models.Customer.id.asc(),).all()
+what_is_up_with_those_new_coord_names = (coord_names + set(vars_to_create)) + set(
+ vars_to_remove
+)
+what_is_up_with_those_new_coord_names = (coord_names | set(vars_to_create)) - set(
+ vars_to_remove
+)
+what_is_up_with_those_new_coord_names = (
+ coord_names + set(vars_to_create)
+) + set(vars_to_remove)
+what_is_up_with_those_new_coord_names = (
+ coord_names | set(vars_to_create)
+) - set(vars_to_remove)
+result = (
+ session.query(models.Customer.id)
+ .filter(
+ models.Customer.account_id == account_id, models.Customer.email == email_address
+ models.Customer.account_id == account_id,
+ models.Customer.email == email_address,
+ )
+ .order_by(models.Customer.id.asc())
+ .all()
@@ -371,7 +371,9 @@ def gen():
very_long_variable_name_filters: t.List[
t.Tuple[str, t.Union[str, t.List[t.Optional[str]]]],
]
xxxx_xxxxx_xxxx_xxx: Callable[..., List[SomeClass]] = classmethod( # type: ignore
xxxx_xxxxx_xxxx_xxx: Callable[
..., List[SomeClass]
] = classmethod( # type: ignore
sync(async_xxxx_xxx_xxxx_xxxxx_xxxx_xxx.__func__)
)
xxxx_xxx_xxxx_xxxxx_xxxx_xxx: Callable[
@@ -436,16 +438,17 @@ def gen():
e = (1,).count(1)
f = 1, *range(10)
g = 1, *"ten"
what_is_up_with_those_new_coord_names = (coord_names + set(vars_to_create)) + set(
vars_to_remove
)
what_is_up_with_those_new_coord_names = (coord_names | set(vars_to_create)) - set(
vars_to_remove
)
what_is_up_with_those_new_coord_names = (
coord_names + set(vars_to_create)
) + set(vars_to_remove)
what_is_up_with_those_new_coord_names = (
coord_names | set(vars_to_create)
) - set(vars_to_remove)
result = (
session.query(models.Customer.id)
.filter(
models.Customer.account_id == account_id, models.Customer.email == email_address
models.Customer.account_id == account_id,
models.Customer.email == email_address,
)
.order_by(models.Customer.id.asc())
.all()
@@ -224,7 +224,9 @@ def func_no_args():
def function_signature_stress_test(number:int,no_annotation=None,text:str='default',* ,debug:bool=False,**kwargs) -> str:
return text[number:-1]
# fmt: on
def spaces(a=1, b=(), c=[], d={}, e=True, f=-1, g=1 if False else 2, h="", i=r""):
def spaces(
a=1, b=(), c=[], d={}, e=True, f=-1, g=1 if False else 2, h="", i=r""
):
offset = attr.ib(default=attr.Factory(lambda: _r.uniform(1, 2)))
assert task._cancel_stack[: len(old_stack)] == old_stack

@@ -143,7 +143,9 @@ def function_signature_stress_test(
return text[number:-1]


def spaces(a=1, b=(), c=[], d={}, e=True, f=-1, g=1 if False else 2, h="", i=r""):
def spaces(
a=1, b=(), c=[], d={}, e=True, f=-1, g=1 if False else 2, h="", i=r""
):
offset = attr.ib(default=attr.Factory(lambda: _r.uniform(10000, 200000)))
assert task._cancel_stack[: len(old_stack)] == old_stack

0 comments on commit b5f6ecf

Please sign in to comment.
You can’t perform that action at this time.