add more tests

This commit is contained in:
Thomas Waldmann 2016-04-25 14:12:39 +02:00
parent e81407ff81
commit 46362a1962
1 changed files with 13 additions and 0 deletions

View File

@ -40,11 +40,24 @@ def test_item_from_dict():
assert item.mode == 0o666
assert 'path' in item
# does not matter whether we get str or bytes keys
item = Item({'path': b'/a/b/c', 'mode': 0o666})
assert item.path == '/a/b/c'
assert item.mode == 0o666
assert 'mode' in item
# invalid - no dict
with pytest.raises(TypeError):
Item(42)
# invalid - no bytes/str key
with pytest.raises(TypeError):
Item({42: 23})
# invalid - unknown key
with pytest.raises(ValueError):
Item({'foobar': 'baz'})
def test_item_from_kw():
item = Item(path=b'/a/b/c', mode=0o666)