Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchainz authored Feb 6, 2025
1 parent 2ac3a8b commit 00db405
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Changelog
=========

* Support single-tuple Django version in the versioned block fixer.
* Extend versioned block fixer to support comparisons with single-item tuples, like `django.VERSION >= (4,)`.

Thanks to Thibaut Decombe in `PR #517 <https://github.com/adamchainz/django-upgrade/pull/517>`__.

Expand Down
2 changes: 1 addition & 1 deletion src/django_upgrade/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def is_passing_comparison(
and isinstance(test.ops[0], (ast.Gt, ast.GtE, ast.Lt, ast.LtE))
and len(test.comparators) == 1
and isinstance((comparator := test.comparators[0]), ast.Tuple)
and 0 < len(comparator.elts) <= 2
and 1 <= len(comparator.elts) <= 2
and all(isinstance(e, ast.Constant) for e in comparator.elts)
and all(isinstance(cast(ast.Constant, e).value, int) for e in comparator.elts)
):
Expand Down

0 comments on commit 00db405

Please sign in to comment.