(self)
| 1776 | self.assertEqual(d[kw], o) |
| 1777 | |
| 1778 | def test_weak_valued_union_operators(self): |
| 1779 | a = C() |
| 1780 | b = C() |
| 1781 | c = C() |
| 1782 | wvd1 = weakref.WeakValueDictionary({1: a}) |
| 1783 | wvd2 = weakref.WeakValueDictionary({1: b, 2: a}) |
| 1784 | wvd3 = wvd1.copy() |
| 1785 | d1 = {1: c, 3: b} |
| 1786 | pairs = [(5, c), (6, b)] |
| 1787 | |
| 1788 | tmp1 = wvd1 | wvd2 # Between two WeakValueDictionaries |
| 1789 | self.assertEqual(dict(tmp1), dict(wvd1) | dict(wvd2)) |
| 1790 | self.assertIs(type(tmp1), weakref.WeakValueDictionary) |
| 1791 | wvd1 |= wvd2 |
| 1792 | self.assertEqual(wvd1, tmp1) |
| 1793 | |
| 1794 | tmp2 = wvd2 | d1 # Between WeakValueDictionary and mapping |
| 1795 | self.assertEqual(dict(tmp2), dict(wvd2) | d1) |
| 1796 | self.assertIs(type(tmp2), weakref.WeakValueDictionary) |
| 1797 | wvd2 |= d1 |
| 1798 | self.assertEqual(wvd2, tmp2) |
| 1799 | |
| 1800 | tmp3 = wvd3.copy() # Between WeakValueDictionary and iterable key, value |
| 1801 | tmp3 |= pairs |
| 1802 | self.assertEqual(dict(tmp3), dict(wvd3) | dict(pairs)) |
| 1803 | self.assertIs(type(tmp3), weakref.WeakValueDictionary) |
| 1804 | |
| 1805 | tmp4 = d1 | wvd3 # Testing .__ror__ |
| 1806 | self.assertEqual(dict(tmp4), d1 | dict(wvd3)) |
| 1807 | self.assertIs(type(tmp4), weakref.WeakValueDictionary) |
| 1808 | |
| 1809 | del a |
| 1810 | self.assertNotIn(2, tmp1) |
| 1811 | self.assertNotIn(2, tmp2) |
| 1812 | self.assertNotIn(1, tmp3) |
| 1813 | self.assertNotIn(1, tmp4) |
| 1814 | |
| 1815 | def test_weak_keyed_dict_update(self): |
| 1816 | self.check_update(weakref.WeakKeyDictionary, |
nothing calls this directly
no test coverage detected