def test_pull__string_arg__raises_TypeError(self):
     a = NestedDict({"k": "v"})
     with self.assertRaises(AttributeError):
         a.pull("k", "v")
 def test_pull__string_arg__raises_ValueError(self):
     a = NestedDict({"k": []})
     with self.assertRaises(ValueError):
         a.pull("k", "v")
 def test_pull__string_arg__raises_KeyError(self):
     a = NestedDict()
     with self.assertRaises(KeyError):
         a.pull("k", "v")
 def test_pull__path_arg(self):
     a = NestedDict({"k1": {"k2": {"k3": ["v"]}}})
     a.pull(("k1", "k2", "k3"), "v")
     self.assertEqual(a, {"k1": {"k2": {"k3": []}}})
 def test_pull__cleanup_True__removes_empty_containers(self):
     a = NestedDict({"k": ["v"]})
     a.pull("k", "v", cleanup=True)
     self.assertEqual(a, {})
 def test_pull__string_arg(self):
     a = NestedDict({"k": ["v"]})
     a.pull("k", "v")
     self.assertEqual(a, {"k": []})