(self, typecallable)
| 1468 | ) |
| 1469 | |
| 1470 | def _test_dict_dataclasses(self, typecallable): |
| 1471 | creator = self.SimpleComparableEntity |
| 1472 | |
| 1473 | @dataclasses.dataclass |
| 1474 | class Foo: |
| 1475 | attr: MutableMapping[Any, Any] = dataclasses.field( |
| 1476 | default_factory=dict |
| 1477 | ) |
| 1478 | |
| 1479 | canary = Canary() |
| 1480 | instrumentation.register_class(Foo) |
| 1481 | d = _register_attribute( |
| 1482 | Foo, |
| 1483 | "attr", |
| 1484 | uselist=True, |
| 1485 | typecallable=typecallable, |
| 1486 | useobject=True, |
| 1487 | ) |
| 1488 | canary.listen(d) |
| 1489 | |
| 1490 | obj = Foo() |
| 1491 | direct = obj.attr |
| 1492 | |
| 1493 | e1 = creator(a=1, b=2) |
| 1494 | collections.collection_adapter(direct).append_with_event(e1) |
| 1495 | |
| 1496 | like_me = typecallable() |
| 1497 | like_me.set(e1) |
| 1498 | |
| 1499 | eq_(dataclasses.asdict(obj), {"attr": like_me}) |
| 1500 | |
| 1501 | def test_dict_subclass(self): |
| 1502 | class MyDict(dict): |
no test coverage detected