Skip to content

Commit

Permalink
Merge branch 'master' into py310
Browse files Browse the repository at this point in the history
  • Loading branch information
hynek authored Feb 19, 2021
2 parents 6e3afdb + baa8f8c commit d6d46f2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,3 +622,19 @@ class C(object):
c2 = evolve(c1, a={"c": {"e": 23}}, b=42)

assert c2 == C(N1(N2(23), 2), 42)

def test_recursive_dict_val(self):
"""
evolve() only attempts recursion when the current value is an ``attrs``
class. Dictionaries as values can be replaced like any other value.
"""

@attr.s
class C(object):
a = attr.ib(type=dict)
b = attr.ib(type=int)

c1 = C({"spam": 1}, 2)
c2 = evolve(c1, a={"eggs": 2}, b=42)

assert c2 == C({"eggs": 2}, 42)

0 comments on commit d6d46f2

Please sign in to comment.