def test_propclass_copy_more(): p = Properties() p.load(StringIO(INPUT)) p2 = p.copy() assert p is not p2 assert isinstance(p2, Properties) assert p == p2 assert dict(p) == dict(p2) == { "foo": "second definition", "bar": "only definition", "key": "value", "zebra": "apple", } p2["foo"] = "third definition" del p2["bar"] p2["key"] = "value" p2["zebra"] = "horse" p2["new"] = "old" assert p != p2 assert dict(p) == { "foo": "second definition", "bar": "only definition", "key": "value", "zebra": "apple", } assert dict(p2) == { "foo": "third definition", "key": "value", "zebra": "horse", "new": "old", }
def test_propclass_copy(): p = Properties({"Foo": "bar"}) p2 = p.copy() assert p is not p2 assert isinstance(p2, Properties) assert p == p2 assert dict(p) == dict(p2) == {"Foo": "bar"} p2["Foo"] = "gnusto" assert dict(p) == {"Foo": "bar"} assert dict(p2) == {"Foo": "gnusto"} assert p != p2 p2["fOO"] = "quux" assert dict(p) == {"Foo": "bar"} assert dict(p2) == {"Foo": "gnusto", "fOO": "quux"} assert p != p2