@@ -2104,24 +2104,40 @@ class TestSymmetricEmptyValEquivalency(TestCase):
21042104
21052105 def test (self ):
21062106
2107- class EmptyEqEnum (TextChoices , s ('prop' , case_fold = True )):
2107+ # version 1.5.0 of enum_properties changed the default symmetricity
2108+ # of none values.
2109+ from enum_properties import VERSION
2110+ match_none = {} if VERSION < (1 , 5 , 0 ) else {'match_none' : True }
2111+
2112+ class EmptyEqEnum (EnumProperties , s ('label' , case_fold = True )):
21082113
2109- A = 'A' , 'ok '
2110- B = 'B' , 'none '
2114+ A = 'A' , 'A Label '
2115+ B = None , 'B Label '
21112116
21122117 try :
21132118 form_field = EnumChoiceField (enum = EmptyEqEnum )
2114- self .assertTrue (None not in form_field .empty_values )
2115- except Exception : # pragma: no cover
2119+ except Exception as err : # pragma: no cover
21162120 self .fail (
21172121 "EnumChoiceField() raised value error with alternative"
21182122 "empty_value set."
21192123 )
21202124
2121- # version 1.5.0 of enum_properties changed the default symmetricity
2122- # of none values.
2123- from enum_properties import VERSION
2124- match_none = {} if VERSION < (1 , 5 , 0 ) else {'match_none' : True }
2125+ self .assertTrue (None not in form_field .empty_values )
2126+
2127+ class EmptyEqEnum (EnumProperties , s ('label' , case_fold = True ), s ('prop' , match_none = True )):
2128+
2129+ A = 'A' , 'A Label' , 4
2130+ B = 'B' , 'B Label' , None
2131+
2132+ try :
2133+ form_field = EnumChoiceField (enum = EmptyEqEnum )
2134+ except Exception as err : # pragma: no cover
2135+ self .fail (
2136+ "EnumChoiceField() raised value error with alternative"
2137+ "empty_value set."
2138+ )
2139+
2140+ self .assertTrue (None not in form_field .empty_values )
21252141
21262142 class EmptyEqEnum2 (
21272143 TextChoices ,
0 commit comments