fix DefaultDict.__or__

This commit is contained in:
Aman Karmani
2023-08-10 03:56:50 +00:00
parent 918f1b0dfb
commit a13e45d548
2 changed files with 10 additions and 0 deletions

View File

@@ -72,6 +72,13 @@ class DictDefaultTest(unittest.TestCase):
assert cfg.random_key is None, "DictDefault should return None for missing keys"
def test_dict_or(self):
cfg = DictDefault({}) | DictDefault({})
assert (
cfg.random_key is None
), "DictDefault should return None for missing keys after | operation"
def test_dict_nested_missingparentkey(self):
"""
Due to subclassing Dict, DictDefault will error if we try to access a nested key whose parent key does not exist.