예제 #1
0
 def test_readonlydict(self):
     # Assert read-only dict.
     v = vector.readonlydict({"a":1})
     self.assertTrue(isinstance(v, dict))
     self.assertRaises(vector.ReadOnlyError, v.__setitem__, "a", 2)
     self.assertRaises(vector.ReadOnlyError, v.__delitem__, "a")
     self.assertRaises(vector.ReadOnlyError, v.pop, "a")
     self.assertRaises(vector.ReadOnlyError, v.popitem, ("a", 2))
     self.assertRaises(vector.ReadOnlyError, v.clear)
     self.assertRaises(vector.ReadOnlyError, v.update, {"b": 2})
     self.assertRaises(vector.ReadOnlyError, v.setdefault, "b", 2)
     print("pattern.vector.readonlydict")
예제 #2
0
 def test_readonlydict(self):
     # Assert read-only dict.
     v = vector.readonlydict({"a": 1})
     self.assertTrue(isinstance(v, dict))
     self.assertRaises(vector.ReadOnlyError, v.__setitem__, "a", 2)
     self.assertRaises(vector.ReadOnlyError, v.__delitem__, "a")
     self.assertRaises(vector.ReadOnlyError, v.pop, "a")
     self.assertRaises(vector.ReadOnlyError, v.popitem, ("a", 2))
     self.assertRaises(vector.ReadOnlyError, v.clear)
     self.assertRaises(vector.ReadOnlyError, v.update, {"b": 2})
     self.assertRaises(vector.ReadOnlyError, v.setdefault, "b", 2)
     print "pattern.vector.readonlydict"