MCPcopy
hub / github.com/python-attrs/attrs / test_default

Method test_default

tests/test_dunders.py:809–825  ·  view source on GitHub ↗

If a default value is present, it's used as fallback.

(self)

Source from the content-addressed store, hash-verified

807 assert 2 == obj.b
808
809 def test_default(self):
810 """
811 If a default value is present, it's used as fallback.
812 """
813
814 class C:
815 __attrs_attrs__ = [
816 simple_attr(name="a", default=2),
817 simple_attr(name="b", default="hallo"),
818 simple_attr(name="c", default=None),
819 ]
820
821 C = _add_init(C, False)
822 i = C()
823 assert 2 == i.a
824 assert "hallo" == i.b
825 assert None is i.c
826
827 def test_factory(self):
828 """

Callers

nothing calls this directly

Calls 2

_add_initFunction · 0.85
CClass · 0.70

Tested by

no test coverage detected