Esempio n. 1
0
def test_save_load_schema():
    r"""Test saving & loading schema."""
    fname = 'test_schema.yml'
    if os.path.isfile(fname):  # pragma: debug
        os.remove(fname)
    # Test saving/loading schema
    s0 = schema.load_schema()
    s0.save(fname)
    assert (s0 is not None)
    assert (os.path.isfile(fname))
    s1 = schema.get_schema(fname)
    assert (s1.schema == s0.schema)
    # assert(s1 == s0)
    os.remove(fname)
    # Test getting schema
    s2 = schema.load_schema(fname)
    assert (os.path.isfile(fname))
    assert (s2.schema == s0.schema)
    assert (s2 == s0)
    os.remove(fname)
Esempio n. 2
0
def test_create_schema():
    r"""Test creating new schema."""
    fname = 'test_schema.yml'
    if os.path.isfile(fname):  # pragma: debug
        os.remove(fname)
    # Test saving/loading schema
    s0 = schema.create_schema()
    s0.save(fname)
    assert (s0 is not None)
    assert (os.path.isfile(fname))
    s1 = schema.get_schema(fname)
    assert_equal(s1.schema, s0.schema)
    # assert_equal(s1, s0)
    os.remove(fname)
    # Test getting schema
    s2 = schema.load_schema(fname)
    assert (os.path.isfile(fname))
    assert_equal(s2, s0)
    os.remove(fname)