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