Exemple #1
0
def test_item_assignment():
    item = Item()
    item.foo = "Foo Value"
    item.bar = "Bar Value"
    item["kebab-value"] = "A Kebab"
    item["empty"] = ""

    assert item.foo == "Foo Value"
    assert item.bar == "Bar Value"
    assert item["bar"] == "Bar Value"
    assert item["kebab-value"] == "A Kebab"

    assert item.get("kebab-value") == "A Kebab"
    assert item.get("a-missing-value") is None
    assert item.get("empty") is None

    item.set("another", "Another Value")
    assert item.another == "Another Value"
Exemple #2
0
def test_item_assignment():
    item = Item()
    item.foo = "Foo Value"
    item.bar = "Bar Value"
    item['kebab-value'] = "A Kebab"
    item['empty'] = ''

    assert item.foo == "Foo Value"
    assert item.bar == "Bar Value"
    assert item['bar'] == "Bar Value"
    assert item['kebab-value'] == "A Kebab"

    assert item.get('kebab-value') == "A Kebab"
    assert item.get('a-missing-value') is None
    assert item.get('empty') is None

    item.set('another', "Another Value")
    assert item.another == "Another Value"