Created
May 29, 2015 21:21
-
-
Save mgood/74e376102e9e45faf433 to your computer and use it in GitHub Desktop.
jproperties functional tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ py.test | |
============================= test session starts ============================== | |
platform darwin -- Python 2.7.6 -- py-1.4.26 -- pytest-2.7.1 | |
rootdir: /Users/matt/Projects/jprops/.venv/jprops/src/jproperties, inifile: | |
plugins: xdist | |
collected 66 items | |
test_functional.py ........FFFFFF...F.........FFF.FFFFFFFFFF....F...F.FFFFFF.F...FFFF | |
=================================== FAILURES =================================== | |
__________________________ test_load[a : : b-props8] ___________________________ | |
data = 'a : : b', props = {'a': ': b'} | |
@pytest.mark.parametrize('data,props', loading_tests) | |
def test_load(data, props): | |
p = jproperties.Properties() | |
p.load(BytesIO(data)) | |
> assert dict(p.items()) == props | |
E assert {'a': 'b'} == {'a': ': b'} | |
E Differing items: | |
E {'a': 'b'} != {'a': ': b'} | |
E Use -v to get the full diff | |
test_functional.py:93: AssertionError | |
____________________________ test_load[a::b-props9] ____________________________ | |
data = 'a::b', props = {'a': ':b'} | |
@pytest.mark.parametrize('data,props', loading_tests) | |
def test_load(data, props): | |
p = jproperties.Properties() | |
p.load(BytesIO(data)) | |
> assert dict(p.items()) == props | |
E assert {'a': 'b'} == {'a': ':b'} | |
E Differing items: | |
E {'a': 'b'} != {'a': ':b'} | |
E Use -v to get the full diff | |
test_functional.py:93: AssertionError | |
__________________________ test_load[a = = b-props10] __________________________ | |
data = 'a = = b', props = {'a': '= b'} | |
@pytest.mark.parametrize('data,props', loading_tests) | |
def test_load(data, props): | |
p = jproperties.Properties() | |
p.load(BytesIO(data)) | |
> assert dict(p.items()) == props | |
E assert {'a': 'b'} == {'a': '= b'} | |
E Differing items: | |
E {'a': 'b'} != {'a': '= b'} | |
E Use -v to get the full diff | |
test_functional.py:93: AssertionError | |
___________________________ test_load[a==b-props11] ____________________________ | |
data = 'a==b', props = {'a': '=b'} | |
@pytest.mark.parametrize('data,props', loading_tests) | |
def test_load(data, props): | |
p = jproperties.Properties() | |
p.load(BytesIO(data)) | |
> assert dict(p.items()) == props | |
E assert {'a': 'b'} == {'a': '=b'} | |
E Differing items: | |
E {'a': 'b'} != {'a': '=b'} | |
E Use -v to get the full diff | |
test_functional.py:93: AssertionError | |
__________________________ test_load[a = : b-props12] __________________________ | |
data = 'a = : b', props = {'a': ': b'} | |
@pytest.mark.parametrize('data,props', loading_tests) | |
def test_load(data, props): | |
p = jproperties.Properties() | |
p.load(BytesIO(data)) | |
> assert dict(p.items()) == props | |
E assert {'a': 'b'} == {'a': ': b'} | |
E Differing items: | |
E {'a': 'b'} != {'a': ': b'} | |
E Use -v to get the full diff | |
test_functional.py:93: AssertionError | |
__________________________ test_load[a : = b-props13] __________________________ | |
data = 'a : = b', props = {'a': '= b'} | |
@pytest.mark.parametrize('data,props', loading_tests) | |
def test_load(data, props): | |
p = jproperties.Properties() | |
p.load(BytesIO(data)) | |
> assert dict(p.items()) == props | |
E assert {'a': 'b'} == {'a': '= b'} | |
E Differing items: | |
E {'a': 'b'} != {'a': '= b'} | |
E Use -v to get the full diff | |
test_functional.py:93: AssertionError | |
_____________________________ test_load[a-props17] _____________________________ | |
data = 'a', props = {'a': ''} | |
@pytest.mark.parametrize('data,props', loading_tests) | |
def test_load(data, props): | |
p = jproperties.Properties() | |
> p.load(BytesIO(data)) | |
test_functional.py:92: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
jproperties.py:205: in load | |
key, separator, value = self._separate(line) | |
jproperties.py:177: in _separate | |
key = getkey(line) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
s = 'a' | |
def getkey(s): | |
ret = [] | |
escaping = False | |
for c in s: | |
if not escaping: | |
if c in " :=": | |
return "".join(ret) | |
elif c == "\\": | |
escaping = True | |
else: | |
escaping = False | |
ret.append(c) | |
> raise SyntaxError(repr(s)) | |
E SyntaxError: 'a' | |
jproperties.py:154: SyntaxError | |
_________________________ test_load[a \\u00ff-props27] _________________________ | |
data = 'a \\\\u00ff', props = {'a': '\\u00ff'} | |
@pytest.mark.parametrize('data,props', loading_tests) | |
def test_load(data, props): | |
p = jproperties.Properties() | |
p.load(BytesIO(data)) | |
> assert dict(p.items()) == props | |
E assert {'a': '\xff'} == {'a': '\\\\u00ff'} | |
E Differing items: | |
E {'a': '\xff'} != {'a': '\\\\u00ff'} | |
E Use -v to get the full diff | |
test_functional.py:93: AssertionError | |
________________________ test_load[a \\\u00ff-props28] _________________________ | |
data = 'a \\\\\\\\\\\\u00ff', props = {'a': '\\\xff'} | |
@pytest.mark.parametrize('data,props', loading_tests) | |
def test_load(data, props): | |
p = jproperties.Properties() | |
p.load(BytesIO(data)) | |
> assert dict(p.items()) == props | |
E assert {'a': '\\u00ff'} == {'a': '\\\xff'} | |
E Differing items: | |
E {'a': '\\u00ff'} != {'a': '\\\xff'} | |
E Use -v to get the full diff | |
test_functional.py:93: AssertionError | |
________________________ test_load[a \\\\u00ff-props29] ________________________ | |
data = 'a \\\\\\\\u00ff', props = {'a': '\\\\u00ff'} | |
@pytest.mark.parametrize('data,props', loading_tests) | |
def test_load(data, props): | |
p = jproperties.Properties() | |
p.load(BytesIO(data)) | |
> assert dict(p.items()) == props | |
E assert {'a': '\u00ff'} == {'a': '\\\\u00ff'} | |
E Differing items: | |
E {'a': '\u00ff'} != {'a': '\\\\u00ff'} | |
E Use -v to get the full diff | |
test_functional.py:93: AssertionError | |
__________________________ test_load[a \\x7f-props31] __________________________ | |
data = 'a \\\\x7f', props = {'a': '\\x7f'} | |
@pytest.mark.parametrize('data,props', loading_tests) | |
def test_load(data, props): | |
p = jproperties.Properties() | |
p.load(BytesIO(data)) | |
> assert dict(p.items()) == props | |
E assert {'a': ''} == {'a': '\\x7f'} | |
E Differing items: | |
E {'a': ''} != {'a': '\\x7f'} | |
E Use -v to get the full diff | |
test_functional.py:93: AssertionError | |
__________________________ test_load[a | |
b | |
c | |
-props32] ___________________________ | |
data = 'a\nb\nc\n', props = {'a': '', 'b': '', 'c': ''} | |
@pytest.mark.parametrize('data,props', loading_tests) | |
def test_load(data, props): | |
p = jproperties.Properties() | |
> p.load(BytesIO(data)) | |
test_functional.py:92: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
jproperties.py:205: in load | |
key, separator, value = self._separate(line) | |
jproperties.py:177: in _separate | |
key = getkey(line) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
s = 'a' | |
def getkey(s): | |
ret = [] | |
escaping = False | |
for c in s: | |
if not escaping: | |
if c in " :=": | |
return "".join(ret) | |
elif c == "\\": | |
escaping = True | |
else: | |
escaping = False | |
ret.append(c) | |
> raise SyntaxError(repr(s)) | |
E SyntaxError: 'a' | |
jproperties.py:154: SyntaxError | |
_________________________ test_load[a | |
b | |
c | |
-props33] _________________________ | |
data = 'a\r\nb\r\nc\r\n', props = {'a': '', 'b': '', 'c': ''} | |
@pytest.mark.parametrize('data,props', loading_tests) | |
def test_load(data, props): | |
p = jproperties.Properties() | |
> p.load(BytesIO(data)) | |
test_functional.py:92: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
jproperties.py:205: in load | |
key, separator, value = self._separate(line) | |
jproperties.py:177: in _separate | |
key = getkey(line) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
s = 'a' | |
def getkey(s): | |
ret = [] | |
escaping = False | |
for c in s: | |
if not escaping: | |
if c in " :=": | |
return "".join(ret) | |
elif c == "\\": | |
escaping = True | |
else: | |
escaping = False | |
ret.append(c) | |
> raise SyntaxError(repr(s)) | |
E SyntaxError: 'a' | |
jproperties.py:154: SyntaxError | |
__________________________ test_load[a | |
b | |
c | |
-props34] ___________________________ | |
data = 'a\rb\rc\r', props = {'a': '', 'b': '', 'c': ''} | |
@pytest.mark.parametrize('data,props', loading_tests) | |
def test_load(data, props): | |
p = jproperties.Properties() | |
> p.load(BytesIO(data)) | |
test_functional.py:92: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
jproperties.py:205: in load | |
key, separator, value = self._separate(line) | |
jproperties.py:177: in _separate | |
key = getkey(line) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
s = 'a\rb\rc' | |
def getkey(s): | |
ret = [] | |
escaping = False | |
for c in s: | |
if not escaping: | |
if c in " :=": | |
return "".join(ret) | |
elif c == "\\": | |
escaping = True | |
else: | |
escaping = False | |
ret.append(c) | |
> raise SyntaxError(repr(s)) | |
E SyntaxError: 'a\rb\rc' | |
jproperties.py:154: SyntaxError | |
________________________ test_load[a | |
b | |
c | |
-props35] ________________________ | |
data = 'a\nb\n \t \n\nc\n', props = {'a': '', 'b': '', 'c': ''} | |
@pytest.mark.parametrize('data,props', loading_tests) | |
def test_load(data, props): | |
p = jproperties.Properties() | |
> p.load(BytesIO(data)) | |
test_functional.py:92: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
jproperties.py:205: in load | |
key, separator, value = self._separate(line) | |
jproperties.py:177: in _separate | |
key = getkey(line) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
s = 'a' | |
def getkey(s): | |
ret = [] | |
escaping = False | |
for c in s: | |
if not escaping: | |
if c in " :=": | |
return "".join(ret) | |
elif c == "\\": | |
escaping = True | |
else: | |
escaping = False | |
ret.append(c) | |
> raise SyntaxError(repr(s)) | |
E SyntaxError: 'a' | |
jproperties.py:154: SyntaxError | |
_________________________ test_load[a | |
b\ | |
c | |
d | |
-props36] _________________________ | |
data = 'a\nb\\\nc\nd\n', props = {'a': '', 'bc': '', 'd': ''} | |
@pytest.mark.parametrize('data,props', loading_tests) | |
def test_load(data, props): | |
p = jproperties.Properties() | |
> p.load(BytesIO(data)) | |
test_functional.py:92: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
jproperties.py:205: in load | |
key, separator, value = self._separate(line) | |
jproperties.py:177: in _separate | |
key = getkey(line) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
s = 'a' | |
def getkey(s): | |
ret = [] | |
escaping = False | |
for c in s: | |
if not escaping: | |
if c in " :=": | |
return "".join(ret) | |
elif c == "\\": | |
escaping = True | |
else: | |
escaping = False | |
ret.append(c) | |
> raise SyntaxError(repr(s)) | |
E SyntaxError: 'a' | |
jproperties.py:154: SyntaxError | |
________________________ test_load[a | |
b \ | |
c | |
d | |
-props37] _________________________ | |
data = 'a\nb \\\nc\nd\n', props = {'a': '', 'b': 'c', 'd': ''} | |
@pytest.mark.parametrize('data,props', loading_tests) | |
def test_load(data, props): | |
p = jproperties.Properties() | |
> p.load(BytesIO(data)) | |
test_functional.py:92: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
jproperties.py:205: in load | |
key, separator, value = self._separate(line) | |
jproperties.py:177: in _separate | |
key = getkey(line) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
s = 'a' | |
def getkey(s): | |
ret = [] | |
escaping = False | |
for c in s: | |
if not escaping: | |
if c in " :=": | |
return "".join(ret) | |
elif c == "\\": | |
escaping = True | |
else: | |
escaping = False | |
ret.append(c) | |
> raise SyntaxError(repr(s)) | |
E SyntaxError: 'a' | |
jproperties.py:154: SyntaxError | |
________________________ test_load[a | |
b\ | |
c | |
d | |
-props38] _________________________ | |
data = 'a\nb\\\n c\nd\n', props = {'a': '', 'bc': '', 'd': ''} | |
@pytest.mark.parametrize('data,props', loading_tests) | |
def test_load(data, props): | |
p = jproperties.Properties() | |
> p.load(BytesIO(data)) | |
test_functional.py:92: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
jproperties.py:205: in load | |
key, separator, value = self._separate(line) | |
jproperties.py:177: in _separate | |
key = getkey(line) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
s = 'a' | |
def getkey(s): | |
ret = [] | |
escaping = False | |
for c in s: | |
if not escaping: | |
if c in " :=": | |
return "".join(ret) | |
elif c == "\\": | |
escaping = True | |
else: | |
escaping = False | |
ret.append(c) | |
> raise SyntaxError(repr(s)) | |
E SyntaxError: 'a' | |
jproperties.py:154: SyntaxError | |
________________________ test_load[a | |
b\\ | |
c | |
d | |
-props39] _________________________ | |
data = 'a\nb\\\\\nc\nd\n', props = {'a': '', 'b\\': '', 'c': '', 'd': ''} | |
@pytest.mark.parametrize('data,props', loading_tests) | |
def test_load(data, props): | |
p = jproperties.Properties() | |
> p.load(BytesIO(data)) | |
test_functional.py:92: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
jproperties.py:205: in load | |
key, separator, value = self._separate(line) | |
jproperties.py:177: in _separate | |
key = getkey(line) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
s = 'a' | |
def getkey(s): | |
ret = [] | |
escaping = False | |
for c in s: | |
if not escaping: | |
if c in " :=": | |
return "".join(ret) | |
elif c == "\\": | |
escaping = True | |
else: | |
escaping = False | |
ret.append(c) | |
> raise SyntaxError(repr(s)) | |
E SyntaxError: 'a' | |
jproperties.py:154: SyntaxError | |
________________________ test_load[a | |
b\\\ | |
c | |
d | |
-props40] ________________________ | |
data = 'a\nb\\\\\\\nc\nd\n', props = {'a': '', 'b\\c': '', 'd': ''} | |
@pytest.mark.parametrize('data,props', loading_tests) | |
def test_load(data, props): | |
p = jproperties.Properties() | |
> p.load(BytesIO(data)) | |
test_functional.py:92: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
jproperties.py:205: in load | |
key, separator, value = self._separate(line) | |
jproperties.py:177: in _separate | |
key = getkey(line) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
s = 'a' | |
def getkey(s): | |
ret = [] | |
escaping = False | |
for c in s: | |
if not escaping: | |
if c in " :=": | |
return "".join(ret) | |
elif c == "\\": | |
escaping = True | |
else: | |
escaping = False | |
ret.append(c) | |
> raise SyntaxError(repr(s)) | |
E SyntaxError: 'a' | |
jproperties.py:154: SyntaxError | |
_________________________ test_store[props4-a = x \f] __________________________ | |
props = {'a': 'x \x0c'}, data = 'a = x \\f' | |
@pytest.mark.parametrize('props,data', storing_tests) | |
def test_store(props, data): | |
p = jproperties.Properties() | |
for key, value in props.iteritems(): | |
p[key] = value | |
> assert str(p) == data | |
E assert 'a = x \\x0c' == 'a = x \\f' | |
E - a = x \\x0c | |
E ? ^^^ | |
E + a = x \\f | |
E ? ^ | |
test_functional.py:145: AssertionError | |
__________________________ test_store[props8-a = \f] ___________________________ | |
props = {'a': '\x0c'}, data = 'a = \\f' | |
@pytest.mark.parametrize('props,data', storing_tests) | |
def test_store(props, data): | |
p = jproperties.Properties() | |
for key, value in props.iteritems(): | |
p[key] = value | |
> assert str(p) == data | |
E assert 'a = \\x0c' == 'a = \\f' | |
E - a = \\x0c | |
E ? ^^^ | |
E + a = \\f | |
E ? ^ | |
test_functional.py:145: AssertionError | |
________________________ test_store[props10-a = \u0000] ________________________ | |
props = {'a': '\x00'}, data = 'a = \\u0000' | |
@pytest.mark.parametrize('props,data', storing_tests) | |
def test_store(props, data): | |
p = jproperties.Properties() | |
for key, value in props.iteritems(): | |
p[key] = value | |
> assert str(p) == data | |
E assert 'a = \\x00' == 'a = \\u0000' | |
E - a = \\x00 | |
E ? ^ | |
E + a = \\u0000 | |
E ? ^ ++ | |
test_functional.py:145: AssertionError | |
________________________ test_store[props11-a = \u0000] ________________________ | |
props = {'a': ' |