spotterbase.test package

Submodules

spotterbase.test.mixins module

class spotterbase.test.mixins.GraphTestMixin(methodName='runTest')

Bases: TestCase

assert_equal_graphs(got: Graph, expected: Graph)

spotterbase.test.test_annotation_serialization module

class spotterbase.test.test_annotation_serialization.TestAnnotationSerialization(methodName='runTest')

Bases: GraphTestMixin, TestCase

converter = <spotterbase.records.jsonld_support.JsonLdRecordConverter object>
example_json_ld_files: list[Path] = [PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/spotterbase/envs/latest/lib/python3.10/site-packages/doc/source/codesnippets/example-annotation.jsonld'), PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/spotterbase/envs/latest/lib/python3.10/site-packages/doc/source/codesnippets/example-target.jsonld')]
fp = <_io.TextIOWrapper name='/home/docs/checkouts/readthedocs.org/user_builds/spotterbase/envs/latest/lib/python3.10/site-packages/spotterbase/resources/sb-context.jsonld' mode='r' encoding='UTF-8'>
package_root = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/spotterbase/envs/latest/lib/python3.10/site-packages/spotterbase')
sb_context = {'@context': {'FragmentTarget': 'https://ns.mathhub.info/project/sb/FragmentTarget', 'ListSelector': 'https://ns.mathhub.info/project/sb/ListSelector', 'MultiTagBody': 'https://ns.mathhub.info/project/sb/MultiTagBody', 'OffsetSelector': 'https://ns.mathhub.info/project/sb/OffsetSelector', 'PathSelector': 'https://ns.mathhub.info/project/sb/PathSelector', 'SimpleTagBody': 'https://ns.mathhub.info/project/sb/SimpleTagBody', 'SpotterRun': 'https://ns.mathhub.info/project/sb/SpotterRun', 'Tag': 'https://ns.mathhub.info/project/sb/Tag', 'TagSet': 'https://ns.mathhub.info/project/sb/TagSet', 'belongsTo': {'@id': 'https://ns.mathhub.info/project/sb/belongsTo', '@type': '@id'}, 'belongsTo_Rev': {'@reverse': 'belongsTo_Rev_unreversed'}, 'belongsTo_Rev_unreversed': {'@id': 'https://ns.mathhub.info/project/sb/belongsTo', '@type': '@id'}, 'comment': {'@id': 'http://www.w3.org/2000/01/rdf-schema#comment', '@type': 'http://www.w3.org/2001/XMLSchema#string'}, 'contains': {'@id': 'https://ns.mathhub.info/project/sb/contains', '@type': '@id'}, 'endPath': {'@id': 'https://ns.mathhub.info/project/sb/endPath', '@type': 'http://www.w3.org/2001/XMLSchema#string'}, 'html-value': {'@id': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', '@type': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML'}, 'isBasedOn': {'@id': 'https://ns.mathhub.info/project/sb/isBasedOn', '@type': '@id'}, 'license': {'@id': 'http://purl.org/dc/terms/license', '@type': '@id'}, 'sb': 'https://ns.mathhub.info/project/sb/', 'spotterVersion': {'@id': 'https://ns.mathhub.info/project/sb/spotterVersion', '@type': 'http://www.w3.org/2001/XMLSchema#string'}, 'startPath': {'@id': 'https://ns.mathhub.info/project/sb/startPath', '@type': 'http://www.w3.org/2001/XMLSchema#string'}, 'subTagOf': {'@id': 'https://ns.mathhub.info/project/sb/subTagOf', '@type': '@id'}, 'title': {'@id': 'http://purl.org/dc/terms/title', '@type': '@id'}, 'val': {'@id': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', '@type': '@id'}, 'vals': {'@container': '@list', '@id': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#value', '@type': '@id'}, 'withSpotter': {'@id': 'https://ns.mathhub.info/project/sb/withSpotter', '@type': '@id'}, 'year': {'@id': 'http://purl.org/dc/terms/date', '@type': 'http://www.w3.org/2001/XMLSchema#gYear'}}}
test_jsonld_is_same_as_generated_triples()
test_load_from_triples()

spotterbase.test.test_corpora module

spotterbase.test.test_dnm module

class spotterbase.test.test_dnm.TestDnm(methodName='runTest')

Bases: GraphTestMixin, TestCase

test_basic_string()
test_dom_range_to_dnm_range()
test_node_based_matches_simple()

Test that the node-based factory creates the same DNM as the simple factory

test_path_selector()

spotterbase.test.test_dnm_nlp module

class spotterbase.test.test_dnm_nlp.TestDnmNlp(methodName='runTest')

Bases: TestCase

test_word_tokenization()

spotterbase.test.test_documentation module

class spotterbase.test.test_documentation.TestDocumentation(methodName='runTest')

Bases: TestCase

test_examples()

spotterbase.test.test_offset_converter module

class spotterbase.test.test_offset_converter.TestOffsetConverter(methodName='runTest')

Bases: TestCase

test_basic()
test_stored_offsets()
test_text_offsets()
spotterbase.test.test_offset_converter.get_xpath_node(tree: _ElementTree, xpath: str) _Element

spotterbase.test.test_rangecmp module

class spotterbase.test.test_rangecmp.TestDocumentation(methodName='runTest')

Bases: TestCase

test_simple()

spotterbase.test.test_rdf module

class spotterbase.test.test_rdf.MyVocab

Bases: Vocabulary

NS: NameSpace = NameSpace(http://example.com/myvocab, prefix=mv:)
someClass: Uri = Uri('http://example.com/myvocabsomeClass')
someRel: Uri = Uri('http://example.com/myvocabsomeRel')
thingA: Uri = Uri('http://example.com/myvocabthingA')
thingB: Uri = Uri('http://example.com/myvocabthingB')
class spotterbase.test.test_rdf.TestRdf(methodName='runTest')

Bases: TestCase

test_context_generation()
test_file_serializer()
test_html_literal()
test_literal()
test_namespacify()
test_ntriples_serialize()
test_rdflib_literal_conversion()
test_turtle_serialize()
test_uri()

spotterbase.test.test_records module

class spotterbase.test.test_records.TestPredicates

Bases: object

edge: PredInfo = PredInfo(uri=Uri('http://example.org/sb-test#edge'), is_rdf_list=False, literal_type=None, is_reversed=False, json_ld_term='edge-in-json-ld', json_ld_type_is_id=True)
edge2: PredInfo = PredInfo(uri=Uri('http://example.org/sb-test#edge'), is_rdf_list=False, literal_type=None, is_reversed=False, json_ld_term='edge2-in-json-ld', json_ld_type_is_id=True)
edge3: PredInfo = PredInfo(uri=Uri('http://example.org/sb-test#edge3'), is_rdf_list=False, literal_type=Uri('http://www.w3.org/2001/XMLSchema#integer'), is_reversed=False, json_ld_term='edge3-in-json-ld', json_ld_type_is_id=False)
class spotterbase.test.test_records.TestRecords(methodName='runTest')

Bases: TestCase

test_simple()
class spotterbase.test.test_records.TestVocab

Bases: Vocabulary

NS: NameSpace = NameSpace(http://example.org/sb-test#, prefix=sbtest:)
edge: Uri = Uri('http://example.org/sb-test#edge')
edge3: Uri = Uri('http://example.org/sb-test#edge3')
thingA: Uri = Uri('http://example.org/sb-test#thingA')
thingB: Uri = Uri('http://example.org/sb-test#thingB')
typeA: Uri = Uri('http://example.org/sb-test#typeA')
typeB: Uri = Uri('http://example.org/sb-test#typeB')

spotterbase.test.test_selector_converter module

class spotterbase.test.test_selector_converter.TestSelectorConverter(methodName='runTest')

Bases: TestCase

test2()
test3()
test_1()

Module contents

class spotterbase.test.InMemoryDocument(uri: Uri, content: bytes)

Bases: Document

get_uri() Uri
open_binary() IO[bytes]