-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
56fa2fe
commit 364b883
Showing
4 changed files
with
262 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,25 @@ | ||
''' | ||
""" | ||
Created on 2024-05-03 | ||
@author: wf | ||
''' | ||
from ngwidgets.basetest import Basetest | ||
""" | ||
from lodstorage.query import EndpointManager | ||
from ngwidgets.basetest import Basetest | ||
|
||
|
||
class TestEndpoints(Basetest): | ||
""" | ||
test endpoint handling according to https://github.com/WolfgangFahl/snapquery/issues/1 | ||
""" | ||
|
||
def setUp(self, debug=False, profile=True): | ||
Basetest.setUp(self, debug=debug, profile=profile) | ||
|
||
def testEndpoints(self): | ||
""" | ||
test the endpoint handling | ||
""" | ||
em=EndpointManager() | ||
ep_names=em.getEndpointNames() | ||
em = EndpointManager() | ||
ep_names = em.getEndpointNames() | ||
self.assertTrue("wikidata" in ep_names) | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
""" | ||
Created on 2024-05-03 | ||
@author: wf | ||
""" | ||
import json | ||
from ngwidgets.basetest import Basetest | ||
|
||
from snapquery.snapquery_core import NamedQueryManager | ||
|
||
|
||
class TestNamedQueryManager(Basetest): | ||
""" | ||
test the named query Manage | ||
""" | ||
|
||
def setUp(self, debug=False, profile=True): | ||
Basetest.setUp(self, debug=debug, profile=profile) | ||
|
||
def testNamedQueries(self): | ||
""" | ||
test getting a named query manager | ||
""" | ||
db_path = "/tmp/named_queries.db" | ||
nqm = NamedQueryManager.from_samples(db_path=db_path) | ||
for name, ex_count in [("x-invalid", -1), ("cats", 223)]: | ||
try: | ||
lod = nqm.query(name) | ||
if self.debug: | ||
print(f"{name}:") | ||
print(json.dumps(lod,default=str,indent=2)) | ||
self.assertEqual(ex_count, len(lod)) | ||
except Exception as ex: | ||
if self.debug: | ||
print(f"{name}:Exception {str(ex)}") | ||
self.assertEqual(-1, ex_count) |