1
0
datagraph/test/test_datagraph.py

27 lines
627 B
Python
Raw Normal View History

2024-07-08 16:53:33 +00:00
import requests_cache
2024-02-17 10:46:07 +00:00
import wikidata.client
import datagraph.schemeld
import datagraph.wikidata_ext
2024-05-27 22:13:56 +00:00
datagraph.wikidata_ext.REQUEST_SESSION = requests_cache.CachedSession('output/testing')
2024-02-17 10:46:07 +00:00
2024-07-08 16:54:14 +00:00
2024-02-17 10:46:07 +00:00
def test_version():
assert datagraph.__version__ is not None
2023-03-06 22:41:49 +00:00
2024-07-08 16:54:14 +00:00
2023-12-12 22:20:58 +00:00
def test_get_triples():
2023-03-06 22:41:49 +00:00
client = wikidata.client.Client()
EQV_PROPERTY = client.get('P1628')
2024-07-08 16:53:33 +00:00
schema_root = 'https://schema.org/'
schema_prop = 'image'
2023-03-06 22:41:49 +00:00
2024-02-17 10:46:07 +00:00
triples_iter = datagraph.wikidata_ext.get_triples(
2024-07-08 16:54:14 +00:00
client=client,
predicate=EQV_PROPERTY,
object=f'{schema_root}{schema_prop}',
2024-02-17 10:46:07 +00:00
)
assert triples_iter is not None