@@ -177,30 +177,30 @@ class MyRequiredTest(HelloTest):
177177
178178 '''
179179
180- # NOTE: We can't use truly private fields in __slots__, because
181- # __setattr__() will be called with their mangled name and we cannot match
182- # them in the __slots__ with making implementation-defined assumptions
183- # about the mangled name. So we just add the `_p_` prefix for "private"
180+ # NOTE: We can't use truly private fields in `__slots__`, because
181+ # `__setattr__()` will be called with their mangled name and we cannot
182+ # match them in the `__slots__` without making implementation-defined
183+ # assumptions about the mangled name. So we just add the `_p_` prefix for
184+ # to denote the "private" fields.
184185
185186 __slots__ = ('_p_default_value' , '_p_field' ,
186187 '_loggable' , '_name' , '_target' )
187188
188189 __mutable_props = ('_default_value' ,)
189190
190191 def __init__ (self , * args , ** kwargs ):
191- field_type = kwargs .pop ('field' , fields .TypedField )
192192 alias = kwargs .pop ('alias' , None )
193-
194- if alias and not isinstance (alias , TestVar ):
195- raise TypeError (f"'alias' must refer to a variable; "
196- f"found { type (alias ).__name__ !r} " )
197-
198193 if alias and 'field' in kwargs :
199194 raise ValueError (f"'field' cannot be set for an alias variable" )
200195
201196 if alias and 'value' in kwargs :
202197 raise ValueError ('alias variables do not accept default values' )
203198
199+ if alias and not isinstance (alias , TestVar ):
200+ raise TypeError (f"'alias' must refer to a variable; "
201+ f"found { type (alias ).__name__ !r} " )
202+
203+ field_type = kwargs .pop ('field' , fields .TypedField )
204204 if alias :
205205 self ._p_default_value = alias ._default_value
206206 else :
0 commit comments