lmdb_store.py 739 B

1234567891011121314151617181920212223242526272829
  1. import pytest
  2. from rdflib import URIRef
  3. from lakesuperior.store_layouts.ldp_rs.lmdb_store import LmdbStore
  4. @pytest.fixture(scope='module')
  5. def store():
  6. return LmdbStore('/tmp/lmdbstore')
  7. @pytest.mark.usefixtures('store')
  8. class TestLmdbStore:
  9. '''
  10. Unit tests for LMDB store.
  11. '''
  12. def test_create_triple(self, store):
  13. '''
  14. Test creation of a single triple.
  15. '''
  16. store.begin()
  17. store.add((
  18. URIRef('urn:test:s'), URIRef('urn:test:p'), URIRef('urn:test:o')))
  19. store.commit()
  20. res = set(store.triples((None, None, None)))
  21. assert len(res) == 1
  22. assert (URIRef('urn:test:s'), URIRef('urn:test:p'), URIRef('urn:test:o')) \
  23. in res