Changeset 3389960 in flexoentity for tests/test_sqlite_backend.py


Ignore:
Timestamp:
02/27/26 13:47:23 (3 days ago)
Author:
Enrico Schwass <ennoausberlin@…>
Branches:
unify_backends
Children:
c1144fd
Parents:
54941b4
Message:

redesign of Identity and PersistanceBackends - this is a breaking change.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/test_sqlite_backend.py

    r54941b4 r3389960  
    44
    55
    6 def make_domain(domain_id="PY_ARITHM"):
    7     return Domain.with_domain_id(
    8         subtype="Domain",
    9         domain_id=domain_id,
    10         fullname="PYTHON_ARITHMETIC",
    11         description="ALL ABOUT ARITHMETIC IN PYTHON",
    12         classification="UNCLASSIFIED",
    13     )
    14 
    15 
    16 def test_sqlite_roundtrip(tmp_path):
     6def test_sqlite_roundtrip(tmp_path, sample_domain):
    177    db_path = tmp_path / "domains.db"
    188    conn = sqlite3.connect(db_path)
     
    2111    backend = SQLiteEntityBackend(Domain, conn, table_name="domains")
    2212
    23     dom = make_domain()
    24     backend.save(dom)
     13    backend.save(sample_domain.to_dict())
    2514
    26     loaded = backend.load(dom.flexo_id)
    27     assert loaded.to_dict() == dom.to_dict()
     15    loaded = backend.load(sample_domain.flexo_id)
     16    assert loaded == sample_domain.to_dict()
    2817
    2918    all_loaded = backend.load_all()
    3019    assert len(all_loaded) == 1
    31     assert all_loaded[0].domain_id == "PY_ARITHM"
     20    assert Domain.from_dict(all_loaded[0]).domain_id == "PY_ARITHM"
Note: See TracChangeset for help on using the changeset viewer.