with self.assertRaises(TypeError):
i |= None
+ # frozendict
+ i_fd = i | frozendict(s)
+ self.assertIs(type(i_fd), defaultdict)
+ self.assertIs(i_fd.default_factory, int)
+ self.assertDictEqual(i_fd, {1: "one", 2: 2, 0: "zero"})
+ self.assertEqual(list(i_fd), [1, 2, 0])
+
+ fd_i = frozendict(s) | i
+ self.assertIs(type(fd_i), frozendict)
+ self.assertEqual(fd_i, {1: "one", 2: 2, 0: "zero"})
+ self.assertEqual(list(fd_i), [0, 1, 2])
+
def test_factory_conflict_with_set_value(self):
key = "conflict_test"
count = 0
self = right;
other = left;
}
- if (!PyDict_Check(other)) {
+ if (!PyAnyDict_Check(other)) {
Py_RETURN_NOTIMPLEMENTED;
}
// Like copy(), this calls the object's class.