Skip to content

Commit 76c83aa

Browse files
committed
Merge branch 'install_permission' of https://github.com/django-commons/django-typer into install_permission
2 parents 75a3fe4 + e978e6c commit 76c83aa

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

tests/test_parser_completers.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2517,29 +2517,28 @@ def test_choices_completer(self):
25172517
f"choices --{field.replace('_', '-')}s {test_str}"
25182518
)
25192519
)
2520-
# postgres normalizes the IPs - revert that
2521-
if field == "ip_choice":
2522-
for idx in range(0, len(completions)):
2523-
completions[idx] = (
2524-
completions[idx][0].split("/")[0],
2525-
completions[idx][1],
2526-
)
2527-
25282520
str_qry = self.MODEL_CLASS.objects.annotate(
25292521
field_as_str=Cast(field, output_field=CharField())
25302522
)
25312523
if test_str:
25322524
str_qry = str_qry.filter(field_as_str__startswith=test_str)
25332525
else:
25342526
str_qry = str_qry.filter(**{f"{field}__isnull": False})
2535-
expected = str_qry.values_list("field_as_str", flat=True).distinct()
2527+
expected = list(
2528+
str_qry.values_list("field_as_str", flat=True).distinct()
2529+
)
25362530

25372531
if not expected:
25382532
self.assertFalse(completions)
25392533
continue
25402534

25412535
n_tests += 1
25422536

2537+
# postgres normalizes the IPs - revert that
2538+
if field == "ip_choice":
2539+
for idx in range(0, len(expected)):
2540+
expected[idx] = expected[idx].split("/")[0]
2541+
25432542
self.assertEqual(
25442543
set(expected),
25452544
set([comp[0] for comp in completions]),

0 commit comments

Comments
 (0)