tests package¶
Submodules¶
tests.basetest module¶
Created on 2021-08-19
@author: wf
- class tests.basetest.Basetest(methodName='runTest')[source]¶
Bases:
TestCase
base test case
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
tests.testEntityManager module¶
Created on 2021-07-23
@author: wf
- class tests.testEntityManager.TestEntityManager(methodName='runTest')[source]¶
Bases:
Basetest
test the entity manager wrapper
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- configure(config: StorageConfig)[source]¶
tests.testJson module¶
Created on 2020-09-12
@author: wf
- class tests.testJson.TestJsonAble(methodName='runTest')[source]¶
Bases:
Basetest
test JSON serialization with JsonAble mixin
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- check(manager, manager1, listName, debugLimit)[source]¶
check that the list of the two managers are the same
- testIssue22()[source]¶
https://github.com/WolfgangFahl/pyLoDStorage/issues/22 Regression: storeToJsonFile and restoreFromJsonFile missing in JSONAble
- testIssue30_SampleLimited()[source]¶
tests if the json export is correctly limited to the fields that are used in the samples
- testStoreAndRestore()[source]¶
test storing and restoring from a JSON file https://github.com/WolfgangFahl/pyLoDStorage/issues/21
tests.testPandas module¶
Created on 2021-06-07
@author: mk
tests.testSPARQL module¶
Created on 2020-08-14
@author: wf
- class tests.testSPARQL.TestSPARQL(methodName='runTest')[source]¶
Bases:
Basetest
Test SPARQL access e.g. Apache Jena via Wrapper
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- checkErrors(errors, expected=0)[source]¶
check the given list of errors - print any errors if there are some and after that assert that the length of the list of errors is zero
- Parameters
errors (list) – the list of errors to check
- getJena(mode='query', debug=False, typedLiterals=False, profile=False)[source]¶
get the jena endpoint for the given mode
- Parameters
mode (string) – query or update
debug (boolean) – True if debug information should be output
typedLiterals (boolean) – True if INSERT DATA SPARQL commands should use typed literals
profile (boolean) – True if profile/timing information should be shown
- testDob()[source]¶
test the DOB (date of birth) function that converts from ISO-Date to datetime.date
- testIssue20And76()[source]¶
see https://github.com/WolfgangFahl/pyLoDStorage/issues/20 add fixNone option to SPARQL results (same functionality as in SQL)
SPARQL GET method support
- testListOfDictInsert()[source]¶
test inserting a list of Dicts and retrieving the values again using a person based example instead of https://en.wikipedia.org/wiki/FOAF_(ontology)
we use an object oriented derivate of FOAF with a focus on datatypes
- testSPARQLErrorMessage()[source]¶
test error handling see https://stackoverflow.com/questions/63486767/how-can-i-get-the-fuseki-api-via-sparqlwrapper-to-properly-report-a-detailed-err
- testStackoverflow55961615Query()[source]¶
see https://stackoverflow.com/questions/55961615/how-to-integrate-wikidata-query-in-python https://stackoverflow.com/a/69771615/1497139
tests.testSqlite3 module¶
Created on 2020-08-24
@author: wf
- class tests.testSqlite3.TestSQLDB(methodName='runTest')[source]¶
Bases:
Basetest
Test the SQLDB database wrapper
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- checkListOfRecords(listOfRecords, entityName, primaryKey=None, executeMany=True, fixNone=False, fixDates=False, debug=False, doClose=True)[source]¶
check the handling of the given list of Records
- Parameters
listOfRecords (list) – a list of dicts that contain the data to be stored
entityName (string) – the name of the entity type to be used as a table name
primaryKey (string) – the name of the key / column to be used as a primary key
executeMany (boolean) – True if executeMany mode of sqlite3 should be used
fixNone (boolean) – fix dict entries that are undefined to have a “None” entry
debug (boolean) – True if debug information e.g. CREATE TABLE and INSERT INTO commands should be shown
doClose (boolean) – True if the connection should be closed
- testBindingError()[source]¶
test list of Records with incomplete record leading to “You did not supply a value for binding 2” see https://bugs.python.org/issue41638
- testIssue13_setNoneValue()[source]¶
https://github.com/WolfgangFahl/pyLoDStorage/issues/13 set None value for undefined LoD entries
- testIssue14_execute()[source]¶
https://github.com/WolfgangFahl/pyLoDStorage/issues/14
offer execute wrapper directly via sqlDB
- testIssue15()[source]¶
https://github.com/WolfgangFahl/pyLoDStorage/issues/15
auto create view ddl in mergeschema
- testIssue16()[source]¶
https://github.com/WolfgangFahl/pyLoDStorage/issues/16 allow to only warn if samplerecordcount is higher than number of available records
- testIssue41()[source]¶
https://github.com/WolfgangFahl/pyLoDStorage/issues/41 improve error message when create table command fails
- testSqllite3Speed()[source]¶
test sqlite3 speed with some 100000 artificial sample records consisting of two columns with a running index
- testUniqueConstraint()[source]¶
test for https://github.com/WolfgangFahl/pyLoDStorage/issues/4 sqlite3.IntegrityError: UNIQUE constraint failed: … show debug info
tests.testTrulyTabular module¶
Created on 2022-03-4
@author: wf
- class tests.testTrulyTabular.TestTrulyTabular(methodName='runTest')[source]¶
Bases:
TestCase
test Truly tabular analysis
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- documentQuery(tt, query, show=True, formats=['mediawiki'])[source]¶
document the given query for the given TrueTabular instance
- testMostFrequentProperties()[source]¶
test getting the most frequent properties for some Wikidata Item types
tests.test_Plot module¶
Created on 2020-07-05
@author: wf
tests.test_Tabulate module¶
Created on 2021-06-13
@author: wf
- class tests.test_Tabulate.TestTabulate(methodName='runTest')[source]¶
Bases:
Basetest
test tabulate support/compatibility
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- testIssue24_IntegrateTabulate()[source]¶
https://github.com/WolfgangFahl/pyLoDStorage/issues/24
test https://pypi.org/project/tabulate/ support
tests.test_csv module¶
- class tests.test_csv.TestCSV(methodName='runTest')[source]¶
Bases:
Basetest
Tests functionalities for the conversion between csv and list od dicts (LoD)
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- testCsvFromJSONAbleExcludeFields()[source]¶
tests generation of csv from list of JSONAble object with excluding specific fields (negative list)
- testCsvFromJSONAbleIncludeFields()[source]¶
tests generation of csv from list of JSONAble object with including only specified fields (positive list)
- test_from_csv_without_header()[source]¶
tests if csv string without embedded headers is parsed correctly
- test_round_trip()[source]¶
tests the csv round trip: dict -> csv -> dict Note: the inital dict has missing values it is expected that the final dict has the missing keys with None as value
tests.test_lod module¶
Created on 2021-06-11
@author: wf
- class tests.test_lod.TestLOD(methodName='runTest')[source]¶
Bases:
Basetest
test list of dicts base functionality
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- checkHandleListTypeResult(lod, expectedLen, expected)[source]¶
check the result of the handleListType function
- Parameters
lod (list) – the list of dicts to check
expectedLen (int) – the expected Length
expected (str) – the expected entry for the München,Munich Q1524 record with a list
- testGetLookupIssue31And32()[source]¶
test for https://github.com/WolfgangFahl/pyLoDStorage/issues/31 test for https://github.com/WolfgangFahl/pyLoDStorage/issues/32
tests.test_queries module¶
Created on 2021-01-29
@author: wf
- class tests.test_queries.TestEndpoints(methodName='runTest')[source]¶
Bases:
Basetest
tests Endpoint
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- class tests.test_queries.TestQueries(methodName='runTest')[source]¶
Bases:
Basetest
Test query handling
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- captureQueryMain(args)[source]¶
run queryMain and capture stdout
- Parameters
args (list) – command line arguments
- Returns
the stdout content of the command line call
- Return type
str