def test_rrd_unmap_original(): r = RRD({1: 2}) r.remap({1: "foo"}) assert r["foo"] == 2 assert r.original == {1: 2} r.unmap() assert r.original == {1: 2}
def test_rrd_unmap(): r = RRD({1: 2}) assert r[1] == 2 r.remap({1: "foo"}) assert r["foo"] == 2 with pytest.raises(KeyError): r[1] r.unmap() assert r[1] == 2 with pytest.raises(KeyError): r["foo"]
def test_rrd_unmap_reversed(): r = RRD({1: 2}) assert not hasattr(r, "_reversed") r.reversed assert hasattr(r, "_reversed") r.remap({1: "foo"}) assert not hasattr(r, "_reversed") r.reversed assert hasattr(r, "_reversed") r.unmap() assert not hasattr(r, "_reversed") assert r.reversed == {2: 1} assert hasattr(r, "_reversed")