Lines Matching defs:the
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.
145 # use the user-provided __hash__.
154 # use the generated __hash__.
197 # Note that x from C1 replaces x in Base, but the order remains
198 # the same as defined in Base.
225 # Make sure the first parameter is not named 'self'.
235 # Make sure the first parameter is named 'self'.
298 # Ensure that order=False is the default.
326 # Ensure that order=False is the default.
359 # Ensure that order=False is the default.
499 # If we delete the instance attribute, we should then see the
549 # Make sure that the machinery looking for hashability is using the
550 # class's __hash__, not the instance's __hash__.
553 # This shouldn't make the variable hashable.
577 # __hash__ contains the field.
580 # The field is not present in the hash.
586 # If init=False and no default value, then the field won't be
587 # present in the instance.
690 # For the known types, don't allow mutable default values.
735 # If a mutable default isn't in the known list of
779 # Test that some of the problems with namedtuple don't happen
800 # Make sure another class with the same field names isn't
827 # Check the return type, should be None.
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.
880 # Test that MISSING works the same as a default not being
901 # Test that MISSING works the same as a default factory not
902 # being specified (which is really the same as a default not
965 # Creating the class won't raise
1051 # add a test to make sure that the current behavior doesn't change.
1071 # (because that's the rule: it's never added by @dataclass, it's only
1072 # the class author that can add it), then B0.__post_init__ is called.
1079 # Now, the same thing, except A1 defines __post_init__.
1101 # needed, but I'm including it just to demonstrate the changed
1136 # If a ClassVar has no default value, it should not be set on the class.
1155 # If a ClassVar has a default value, it should be set on the class.
1183 # We can still modify the ClassVar, it's only instances that are
1194 # If an InitVar has no default value, it should not be set on the class.
1213 # If an InitVar has a default value, it should be set on the class.
1240 # Make sure the repr is correct.
1258 # We can instantiate by passing the InitVar, even though
1340 # Make sure the default factory is called for each new instance.
1485 # and get back the same thing.
1657 # Make sure that the returned dicts are actually OrderedDicts.
1823 # Create the class.
1837 # Create the class.
1915 # Make sure the default metadata is read-only and of
2007 # Subscripting the resulting class should work, etc.
2119 # This is still an error: make sure we don't pick up the
2120 # type annotation in the base class.
2126 # Same test, but with the base class not a dataclass.
2132 # This is still an error: make sure we don't pick up the
2133 # type annotation in the base class.
2142 # (see bpo #32108), for the time being just compare them with
2259 # Make sure that if we don't add an init, the base __init__
2282 # If the class has __init__, use it no matter the value of
2373 # If the class has __repr__, use it no matter the value of
2417 # If the class has __eq__, use it no matter the value of
2453 # Perform the test "backward", just to make
2552 # See if the result matches what's expected.
2554 # __hash__ contains the function we generated.
2569 # Creating the class should cause an exception.
2601 # make sure the data-driven table in the decorator
2631 # And check that the classes __eq__ is being used, despite
2668 # make sure that if the @dataclass parameter name is changed
2669 # or the non-default hashing behavior changes, the default
2670 # hashability keeps working the same way.
2676 # If frozen or eq is None, then use the default value (do not
2677 # specify any value in the decorator).
2700 # First, create the class.
2730 # won't tell us much. So, just check the
2867 # But can't change the frozen attributes.
2906 # If x is immutable, we can compute the hash. No exception is
2910 # If x is mutable, computing the hash is an error.
2954 # We can add a new field to the derived instance.
3194 # __weakref__ is in the base class, not A. But an A is still weakref-able.
3202 # in the base class.
3210 # __weakref__ is in the base class, not A. But an A is still
3245 # __weakref__ is in the base class, not A. But an instance of A
3262 # __weakref__ is in the base class, not A. Even though A doesn't
3278 # __weakref__ is in the base class, not A. But an instance of
3300 # This is the case of just normal descriptor behavior, no
3301 # dataclass code is involved in initializing the descriptor.
3307 # Now test with a default value and init=False, which is the
3309 # init=False, then the descriptor will be overwritten, anyway.
3335 # Create an attribute on the instance, not type.
3501 # And it won't appear in the class's dict because it doesn't
3580 # There's a difference in how the ClassVars are
3582 # not. See the imported modules for details.
3590 # There's a difference in how the InitVars are
3592 # not. See the imported modules for details.
3608 # won't exist on the instance.
3819 # Make sure the result is still frozen.
3863 # Make sure y gets the default value.
4310 # Make sure the error is raised in a derived class.