-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Hi
Thanks for the tool. I just used it to mass-modernize asserts across a ~250k line project.
I found a bunch of bugs on the way. Rather than spam you with loads of individual issues, I’m reporting them all here. Happy to split them if you’d prefer, but I see development isn’t ongoing, so I don’t want to burden you.
I also see that Ruff has some powers to do this rewriting now, such as from its pytest-unittest-assertion rule, so maybe this tool is less relevant now.
Anyway, here’s the list, and thanks again!
- It added a second
isinstanceargument outside of parentheses:
assert isinstance(
response.context_data["inline_admin_formset"].formset
), ClickToRenderInlineFormSetBase- Inserted a
\before a comment, which is aSyntaxError:
assert test_count.short_description == \ # type: ignore[union-attr, attr-defined]
"test relation"
- Badly indented a comment, resulting in:
assert something == \
something2
# some comment- The rewriting of
== Truetois Truedidn’t work in many cases, same forFalse/None:
assert form["file_reviewed"].value() == True- It incorrectly ported the
placesargument topytest.approxwhen not provided as a keyword argument:
self.assertAlmostEqual(x, y, 2)
assert x = pytest.approx(y), 2- It incorrectly placed
is not Nonewhen there was amsgargument:
-self.assertIsNotNone(x, y)
+assert x, y is not None- It incorrectly placed
notfor an expression, which needed parnthesizing:
-self.assertFalse(a and b)
+assert not a and b- It poorly rewrote this bad single-argument
assertEqualcall:
def test_example(self):
with self.assertRaises(NotImplementedError):
self.assertEqual(BaseDoor().open())(This call didn't get a chance to crash at runtime because the NotImplementedError was raised first.)
...it ended up attaching the == for the assertEqual later on in the file,.
- It inserted
\into multiline strings, changing their contents:
-self.assertEqual(
- something,
- """
- bla
- bla
- """
-)
+assert \
+ something == \
+ """ \
+ bla \
+ bla \
+ """ \dannysepler
Metadata
Metadata
Assignees
Labels
No labels