def test_repeated(): original = [{"a": "b"}, {"c": "d"}] repeated = java_manifest.loads(java_manifest.dumps(original)) assert repeated == original
def test_duplicate_keys(): with pytest.raises(KeyError): java_manifest.loads("foo: a\nfoo: b")
def test_trailing_newline(): data = java_manifest.loads("foo: bar\n\n\n\n") assert data == [{"foo": "bar"}]
def test_initial_newline(): data = java_manifest.loads("\n\n\n\nfoo: bar") assert data == [{"foo": "bar"}]
def load(s, **kwargs): """Short java_manifest.loads which cleans up multi-line strings""" return java_manifest.loads(textwrap.dedent(s).strip(), **kwargs)