Esempio n. 1
0
def test_update():
    v1 = Dictionary({"a": 1, "b": 2})
    v2 = Dictionary({"b": 3, "c": 4})
    v1.update(v2)
    assert v1 == Dictionary({"a": 1, "b": 3, "c": 4})
    assert v2 == Dictionary({"b": 3, "c": 4})

    v2.update({"d": 5, "e": 6})
    assert v1 == Dictionary({"a": 1, "b": 3, "c": 4})
    assert v2 == Dictionary({"b": 3, "c": 4, "d": 5, "e": 6})
Esempio n. 2
0
def test_update():
    v = Dictionary({"a": 1, "b": 2, "c": 3})
    v.update({"a": "one", "d": "four"})
    v.update(Dictionary({"b": "two", "e": "five"}))
    assert list(v.keys()) == [
        GDString("a"),
        GDString("b"),
        GDString("c"),
        GDString("d"),
        GDString("e"),
    ]
    assert list(v.values()) == [
        GDString("one"),
        GDString("two"),
        3,
        GDString("four"),
        GDString("five"),
    ]
Esempio n. 3
0
def test_bad_update(arg):
    v = Dictionary()
    with pytest.raises(TypeError):
        v.update(arg)