File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -2517,29 +2517,28 @@ def test_choices_completer(self):
2517
2517
f"choices --{ field .replace ('_' , '-' )} s { test_str } "
2518
2518
)
2519
2519
)
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
-
2528
2520
str_qry = self .MODEL_CLASS .objects .annotate (
2529
2521
field_as_str = Cast (field , output_field = CharField ())
2530
2522
)
2531
2523
if test_str :
2532
2524
str_qry = str_qry .filter (field_as_str__startswith = test_str )
2533
2525
else :
2534
2526
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
+ )
2536
2530
2537
2531
if not expected :
2538
2532
self .assertFalse (completions )
2539
2533
continue
2540
2534
2541
2535
n_tests += 1
2542
2536
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
+
2543
2542
self .assertEqual (
2544
2543
set (expected ),
2545
2544
set ([comp [0 ] for comp in completions ]),
You can’t perform that action at this time.
0 commit comments