29
29
Attribute ,
30
30
ClassProps ,
31
31
Factory ,
32
- Hashability ,
33
- KeywordOnly ,
34
32
_AndValidator ,
35
33
_Attributes ,
36
34
_ClassBuilder ,
@@ -185,7 +183,7 @@ def test_no_modifications(self):
185
183
Does not attach __attrs_attrs__ to the class.
186
184
"""
187
185
C = make_tc ()
188
- _transform_attrs (C , None , False , KeywordOnly .NO , True , None )
186
+ _transform_attrs (C , None , False , ClassProps . KeywordOnly .NO , True , None )
189
187
190
188
assert None is getattr (C , "__attrs_attrs__" , None )
191
189
@@ -195,7 +193,7 @@ def test_normal(self):
195
193
"""
196
194
C = make_tc ()
197
195
attrs , _ , _ = _transform_attrs (
198
- C , None , False , KeywordOnly .NO , True , None
196
+ C , None , False , ClassProps . KeywordOnly .NO , True , None
199
197
)
200
198
201
199
assert ["z" , "y" , "x" ] == [a .name for a in attrs ]
@@ -210,7 +208,7 @@ class C:
210
208
pass
211
209
212
210
assert _Attributes ((), [], {}) == _transform_attrs (
213
- C , None , False , KeywordOnly .NO , True , None
211
+ C , None , False , ClassProps . KeywordOnly .NO , True , None
214
212
)
215
213
216
214
def test_transforms_to_attribute (self ):
@@ -219,7 +217,7 @@ def test_transforms_to_attribute(self):
219
217
"""
220
218
C = make_tc ()
221
219
attrs , base_attrs , _ = _transform_attrs (
222
- C , None , False , KeywordOnly .NO , True , None
220
+ C , None , False , ClassProps . KeywordOnly .NO , True , None
223
221
)
224
222
225
223
assert [] == base_attrs
@@ -237,7 +235,9 @@ class C:
237
235
y = attr .ib ()
238
236
239
237
with pytest .raises (ValueError ) as e :
240
- _transform_attrs (C , None , False , KeywordOnly .NO , True , None )
238
+ _transform_attrs (
239
+ C , None , False , ClassProps .KeywordOnly .NO , True , None
240
+ )
241
241
assert (
242
242
"No mandatory attributes allowed after an attribute with a "
243
243
"default value or factory. Attribute in question: Attribute"
@@ -266,7 +266,7 @@ class C(B):
266
266
y = attr .ib ()
267
267
268
268
attrs , base_attrs , _ = _transform_attrs (
269
- C , None , False , KeywordOnly .YES , True , None
269
+ C , None , False , ClassProps . KeywordOnly .YES , True , None
270
270
)
271
271
272
272
assert len (attrs ) == 3
@@ -282,7 +282,7 @@ class C(B):
282
282
C ,
283
283
None ,
284
284
False ,
285
- KeywordOnly .FORCE ,
285
+ ClassProps . KeywordOnly .FORCE ,
286
286
True ,
287
287
None ,
288
288
)
@@ -308,7 +308,7 @@ class C(Base):
308
308
y = attr .ib ()
309
309
310
310
attrs , base_attrs , _ = _transform_attrs (
311
- C , {"x" : attr .ib ()}, False , KeywordOnly .NO , True , None
311
+ C , {"x" : attr .ib ()}, False , ClassProps . KeywordOnly .NO , True , None
312
312
)
313
313
314
314
assert [] == base_attrs
@@ -540,9 +540,9 @@ class C:
540
540
repr = True ,
541
541
eq = True ,
542
542
order = True ,
543
- hash = Hashability .HASHABLE_CACHED ,
543
+ hash = ClassProps . Hashability .HASHABLE_CACHED ,
544
544
match_args = False ,
545
- kw_only = KeywordOnly .FORCE ,
545
+ kw_only = ClassProps . KeywordOnly .FORCE ,
546
546
has_weakref_slot = True ,
547
547
collect_by_mro = False ,
548
548
str = True ,
@@ -569,9 +569,9 @@ class CDef:
569
569
repr = True ,
570
570
eq = True ,
571
571
order = True ,
572
- hash = Hashability .UNHASHABLE ,
572
+ hash = ClassProps . Hashability .UNHASHABLE ,
573
573
match_args = True ,
574
- kw_only = KeywordOnly .NO ,
574
+ kw_only = ClassProps . KeywordOnly .NO ,
575
575
has_weakref_slot = True ,
576
576
collect_by_mro = False ,
577
577
str = False ,
@@ -2011,9 +2011,9 @@ class C:
2011
2011
repr = True ,
2012
2012
eq = True ,
2013
2013
order = False ,
2014
- hash = Hashability .UNHASHABLE ,
2014
+ hash = ClassProps . Hashability .UNHASHABLE ,
2015
2015
match_args = True ,
2016
- kw_only = KeywordOnly .NO ,
2016
+ kw_only = ClassProps . KeywordOnly .NO ,
2017
2017
has_weakref_slot = False ,
2018
2018
collect_by_mro = True ,
2019
2019
str = False ,
@@ -2046,9 +2046,9 @@ class C:
2046
2046
repr = True ,
2047
2047
eq = True ,
2048
2048
order = False ,
2049
- hash = Hashability .UNHASHABLE ,
2049
+ hash = ClassProps . Hashability .UNHASHABLE ,
2050
2050
match_args = True ,
2051
- kw_only = KeywordOnly .NO ,
2051
+ kw_only = ClassProps . KeywordOnly .NO ,
2052
2052
has_weakref_slot = False ,
2053
2053
collect_by_mro = True ,
2054
2054
str = False ,
@@ -2147,9 +2147,9 @@ def our_hasattr(obj, name, /) -> bool:
2147
2147
repr = True ,
2148
2148
eq = True ,
2149
2149
order = False ,
2150
- hash = Hashability .UNHASHABLE ,
2150
+ hash = ClassProps . Hashability .UNHASHABLE ,
2151
2151
match_args = True ,
2152
- kw_only = KeywordOnly .NO ,
2152
+ kw_only = ClassProps . KeywordOnly .NO ,
2153
2153
has_weakref_slot = True ,
2154
2154
collect_by_mro = True ,
2155
2155
str = False ,
0 commit comments