def test_clear_flexi(): f = Flexi() f["alice"] = 10 f["bob"] = 20 f["carol"] = 30 f["dave"] = 40 assert len(f) == 4 assert len(f.keys()) == 4 assert len(f.values()) == 4 f.clear() assert len(f) == 0 assert len(f.keys()) == 0 assert len(f.values()) == 0
def test_write_dot_read_subscript(): f = Flexi() f.alice = 50 assert f["alice"] == 50 assert len(f) == 1 assert len(f.keys()) == 1 assert len(f.values()) == 1
def test_write_dot_read_get(): f = Flexi() f.alice = 50 assert f.get("alice") == 50 assert len(f) == 1 assert len(f.keys()) == 1 assert len(f.values()) == 1
def test_write_subscript_read_get(): f = Flexi() f["alice"] = 50 assert f.get("alice") == 50 assert len(f) == 1 assert len(f.keys()) == 1 assert len(f.values()) == 1
def test_copy_flexi(): f = Flexi() f["alice"] = 10 f["bob"] = 20 f["carol"] = 30 f["dave"] = 40 assert len(f) == 4 assert len(f.keys()) == 4 assert len(f.values()) == 4 x = f.copy() assert len(x) == 4 assert len(x.keys()) == 4 assert len(x.values()) == 4
def test_constructor_empty(): f = Flexi() assert len(f) == 0 assert len(f.keys()) == 0 assert len(f.values()) == 0