Lines Matching defs:for

22 import typing       # Needed for the string "typing.ClassVar[int]" to work as an annotation.
23 import dataclasses # Needed for the string "dataclasses.InitVar[int]" to work as an annotation.
268 b for b in builtins.__dict__.keys()
271 attributes = [(name, str) for name in builtins_names]
274 c = C(*[name for name in builtins_names])
276 for name in builtins_names:
283 # for frozen data classes.
286 b for b in builtins.__dict__.keys()
289 attributes = [(name, str) for name in builtins_names]
292 c = C(*[name for name in builtins_names])
294 for name in builtins_names:
307 for cls in [C0, C1]:
310 for idx, fn in enumerate([lambda a, b: a < b,
335 for cls in [C0, C1]:
339 for idx, fn in enumerate([lambda a, b: a < b,
370 for cls in [C0, C1]:
376 for idx, fn in enumerate([lambda a, b: a < b,
390 for idx, fn in enumerate([lambda a, b: a == b,
396 for idx, fn in enumerate([lambda a, b: a < b,
404 for idx, fn in enumerate([lambda a, b: a > b,
413 # Comparisons fail for subclasses, even if no fields
423 for idx, (fn, expected) in enumerate([(lambda a, b: a == b, False),
428 for idx, fn in enumerate([lambda a, b: a < b,
439 for (eq, order, result ) in [
538 unhashable_re = 'mutable default .* for field a is not allowed'
549 # Make sure that the machinery looking for hashability is using the
563 for (hash_, compare, result ) in [
615 for f in the_fields:
648 self.assertEqual([(f.name, f.default) for f in fields(C)],
657 self.assertEqual([(f.name, f.default) for f in fields(D)],
667 self.assertEqual([(f.name, f.default) for f in fields(E)],
691 for typ, empty, non_empty in [(list, [], [1]),
698 f'mutable default {typ} for field '
707 f'mutable default {typ} for field '
718 ' for field z is not allowed'
848 # Don't test for the default, since it's set to MISSING.
853 # Don't test for the default, since it's set to MISSING.
1144 # It makes no sense for a ClassVar to have a default factory. When
1202 # It makes no sense for an InitVar to have a default factory. When
1340 # Make sure the default factory is called for each new instance.
1412 # It's an error for a ClassVar to have a factory function.
1454 # Also test for an instance attribute.
1460 for obj in a, b:
1464 # Indirect tests for _is_dataclass_instance().
1516 # Basic tests for asdict(), it should return a new dictionary.
1693 # Basic tests for astuple(), it should return a new tuple.
2067 for sample in samples:
2068 for proto in range(pickle.HIGHEST_PROTOCOL + 1):
2086 for function in (
2142 # (see bpo #32108), for the time being just compare them with
2585 # And for each of these, a different result if
2587 for case, (unsafe_hash, eq, frozen, res_no_defined_hash, res_defined_hash) in enumerate([
2678 for frozen, eq, base, expected in [
2738 assert False, f'unknown value for expected={expected!r}'
2797 for intermediate_class in [True, False]:
2815 for intermediate_class in [True, False]:
2833 for intermediate_class in [True, False]:
3059 for proto in range(pickle.HIGHEST_PROTOCOL + 1):
3112 for proto in range(pickle.HIGHEST_PROTOCOL + 1):
3120 for proto in range(pickle.HIGHEST_PROTOCOL + 1):
3128 for proto in range(pickle.HIGHEST_PROTOCOL + 1):
3475 for typestr in ('ClassVar[int]',
3506 for typestr in ('CV',
3528 for typestr in ('InitVar[int]',
3557 for typestr in ('IV',
3576 for m in (dataclass_module_1, dataclass_module_1_str,
3582 # not. See the imported modules for details.
3592 # not. See the imported modules for details.
3595 for field_name in ('iv0', 'iv1', 'iv2', 'iv3'):
3733 for bad_field in [(),
3740 # And test for things with no len().
3741 for bad_field in [float,
3749 for field in ['a', 'ab']:
3755 for field in ['for', 'async', 'await', 'as']:
3765 for field in ['()', 'x,y', '*', '2@3', '', 'little johnny tables']:
3782 for classname in ['()', 'x,y', '*', '2@3', '']:
4367 # Make sure we still check for non-kwarg non-defaults not following