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

Method test_dicts

tests/test_funcs.py:793–815  ·  view source on GitHub ↗

evolve() can replace an attrs class instance with a dict. See #806

(self)

Source from the content-addressed store, hash-verified

791 )
792
793 def test_dicts(self):
794 """
795 evolve() can replace an attrs class instance with a dict.
796
797 See #806
798 """
799
800 @attr.s
801 class Cls1:
802 param1 = attr.ib()
803
804 @attr.s
805 class Cls2:
806 param2 = attr.ib()
807
808 obj2a = Cls2(param2="a")
809 obj2b = {"foo": 42, "param2": 42}
810
811 obj1a = Cls1(param1=obj2a)
812
813 assert Cls1({"foo": 42, "param2": 42}) == attr.evolve(
814 obj1a, param1=obj2b
815 )
816
817 def test_no_inst(self):
818 """

Callers

nothing calls this directly

Calls 3

Cls2Class · 0.85
Cls1Class · 0.85
evolveMethod · 0.80

Tested by

no test coverage detected