Updated flatten method, now raise KeyError in case of existing key.

This commit is contained in:
Fabio Caccamo 2020-09-17 19:03:29 +02:00
parent 712b8540ff
commit ac3895acd8
1 changed files with 9 additions and 8 deletions

View File

@ -474,14 +474,15 @@ class benedict_test_case(unittest.TestCase):
},
}
b = benedict(d)
f = b.flatten()
r = {
'a': 1,
'b': 2,
'c_d': 4,
}
self.assertEqual(f, r)
self.assertFalse(b is f)
with self.assertRaises(KeyError):
f = b.flatten()
# r = {
# 'a': 1,
# 'b': 2,
# 'c_d': 4,
# }
# self.assertEqual(f, r)
# self.assertFalse(b is f)
def test_fromkeys(self):
k = [