def test_overwrite_fallback(): d = DogmaticDict(fallback={'a': 23}) d['a'] = 0 assert d['a'] == 0 assert list(d.keys()) == ['a'] assert list(d.values()) == [0] assert list(d.items()) == [('a', 0)]
def test_overwrite_fallback(): d = DogmaticDict(fallback={"a": 23}) d["a"] = 0 assert d["a"] == 0 assert list(d.keys()) == ["a"] assert list(d.values()) == [0] assert list(d.items()) == [("a", 0)]
def test_dict_interface_set_item(): d = DogmaticDict() d['a'] = 12 d['b'] = 'foo' assert 'a' in d assert 'b' in d assert d['a'] == 12 assert d['b'] == 'foo' assert set(d.keys()) == {'a', 'b'} assert set(d.values()) == {12, 'foo'} assert set(d.items()) == {('a', 12), ('b', 'foo')}
def test_dict_interface_set_item(): d = DogmaticDict() d["a"] = 12 d["b"] = "foo" assert "a" in d assert "b" in d assert d["a"] == 12 assert d["b"] == "foo" assert set(d.keys()) == {"a", "b"} assert set(d.values()) == {12, "foo"} assert set(d.items()) == {("a", 12), ("b", "foo")}
def test_dict_interface_initialized_empty(): d = DogmaticDict() assert d == {} assert set(d.keys()) == set() assert set(d.values()) == set() assert set(d.items()) == set()
def test_fallback_not_iterated(): d = DogmaticDict(fallback={'a': 23}) d['b'] = 1234 assert list(d.keys()) == ['b'] assert list(d.values()) == [1234] assert list(d.items()) == [('b', 1234)]
def test_fallback_not_iterated(): d = DogmaticDict(fallback={"a": 23}) d["b"] = 1234 assert list(d.keys()) == ["b"] assert list(d.values()) == [1234] assert list(d.items()) == [("b", 1234)]