def test_update(): c = Settings() c.update({'key': 'value'}) assert len(c) == 1 and c['key'] == 'value' c.update({'key': 'value2', 'key2': 'value'}) assert len(c) == 2 and c['key'] == 'value2' and c['key2'] == 'value'
def test_update_by_base_c(): c1 = Settings({'k1': 'c1_k1'}) c2 = Settings({'k1': 'c2_k1', 'k2': 'c2_k2'}, k3='c2_k3') c1.update(c2) assert len(c1) == 3 assert c1['k1'] == 'c2_k1' assert c1['k2'] == 'c2_k2' assert c1['k3'] == 'c2_k3'