def test_item_hash(): item = Item() assert item.json == '{}' assert item.hash == "9e26dfeeb6e641a33dae4961196235bdb965b21b" assert item.hashkey == "tytn73vw4za2gpnojfqrsyrvxw4wlmq3" item.foo = "Foo Value" assert item.json == '{"foo":"Foo Value"}' assert item.hash == "257b86bf0b88dbf40cacff2b649f763d585df662" assert item.hashkey == "ev5ynpylrdn7idfm74vwjh3whvmf35tc" item.bar = "こんにちは、元気ですか" assert item.json == '{"bar":"こんにちは、元気ですか","foo":"Foo Value"}' assert item.hash == "d8d2a8d65415145e4ca092af80cc4c6bfa34519c" assert item.hashkey == "3djkrvsucukf4tfaskxybtcmnp5dium4"
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"
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"