def test_parse_key_values_simple(self): test = [ 'key=value', 'This=THat', 'keY=bar', ] expected = {'key': ['value', 'bar'], 'this': ['THat']} keyvals, errors = cmd.parse_key_values(test) assert expected == keyvals assert not errors
def test_parse_key_values_with_errors(self): test = ['key', '=THat', 'keY=', 'FOO=bar'] expected = { 'foo': ['bar'], } keyvals, errors = cmd.parse_key_values(test) assert expected == keyvals expected = [ 'missing <key> in "=THat".', 'missing <value> in "keY=".', 'missing <value> in "key".' ] assert expected == errors
def test_parse_key_values_empty(self): assert ({}, []) == cmd.parse_key_values([]) assert ({}, []) == cmd.parse_key_values(None)