コード例 #1
0
ファイル: test_dogmatic_dict.py プロジェクト: wecacuee/sacred
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)]
コード例 #2
0
ファイル: test_dogmatic_dict.py プロジェクト: IDSIA/sacred
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)]
コード例 #3
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)]
コード例 #4
0
ファイル: test_dogmatic_dict.py プロジェクト: wecacuee/sacred
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')}
コード例 #5
0
ファイル: test_dogmatic_dict.py プロジェクト: IDSIA/sacred
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')}
コード例 #6
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")}
コード例 #7
0
ファイル: test_dogmatic_dict.py プロジェクト: wecacuee/sacred
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()
コード例 #8
0
ファイル: test_dogmatic_dict.py プロジェクト: wecacuee/sacred
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)]
コード例 #9
0
ファイル: test_dogmatic_dict.py プロジェクト: IDSIA/sacred
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()
コード例 #10
0
ファイル: test_dogmatic_dict.py プロジェクト: IDSIA/sacred
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)]
コード例 #11
0
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)]