Skip to content

Commit 592cbb3

Browse files
authored
Merge pull request #92 from Teester/mock
Convert tests to use mocks
2 parents b428fe3 + 0d70994 commit 592cbb3

22 files changed

Lines changed: 492 additions & 9 deletions

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,10 @@
22
/coverage.xml
33
/.coverage
44
/.idea/*
5+
.vscode/settings.json
6+
entityshape/__pycache__/
7+
entityshape/api_v1/__pycache__/
8+
entityshape/api_v2/__pycache__/
9+
tests/__pycache__/
10+
tests/tests_api_v1/__pycache__/
11+
tests/tests_api_v2/__pycache__/

tests/fixtures/E236.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"id": "E236",
3+
"serializationVersion": "3.0",
4+
"labels": {
5+
"en": "Member of the Oireachtas",
6+
"fr": "membre du Parlement Irlandais"
7+
},
8+
"descriptions": {
9+
"en": "member of the Irish parliament"
10+
},
11+
"aliases": [],
12+
"schemaText": "PREFIX wdt: \u003Chttp://www.wikidata.org/prop/direct/\u003E\nPREFIX wd: \u003Chttp://www.wikidata.org/entity/\u003E\nstart = @\u003CTD\u003E\n\n\u003CTD\u003E EXTRA wdt:P39 wdt:P106 wdt:P27 { # TD can have other position helds or occupations than those mentioned below\n wdt:P31 [wd:Q5]; # 1 instance of with value human\n wdt:P4690 .; # 1 oireachtas member id with any value\n wdt:P39 [wd:Q654291 wd:Q18043391] +; # 1 or more position held with teachta dala or senator of ireland\n wdt:P106 [wd:Q82955] ; # 1 occupation with value politician\n wdt:P734 . +; # 1 or more given name with any value\n wdt:P735 .+; # 1 or more surname with any value\n wdt:P569 .; # 1 date of birth with any value\n wdt:P102 .*; # 0 or more member of political party with any value\n wdt:P21 [wd:Q6581097 wd:Q6581072 wd:Q1097630 wd:Q1052281 wd:Q2449503 wd:Q48270]; # 1 gender with these values\n wdt:P27 [wd:Q27 wd:Q31747 wd:Q1140152] +;\n wdt:P18 . +; # 1 or more images with any value\n}",
13+
"type": "ShExC"
14+
}

tests/fixtures/E295.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"id": "E295",
3+
"serializationVersion": "3.0",
4+
"labels": {
5+
"en": "townland"
6+
},
7+
"descriptions": {
8+
"en": "schema to describe a townland (small geographic division of Ireland)"
9+
},
10+
"aliases": [],
11+
"schemaText": "PREFIX wd: \u003Chttp://www.wikidata.org/entity/\u003E\nPREFIX wdt: \u003Chttp://www.wikidata.org/prop/direct/\u003E\nstart = @\u003Ctownland\u003E\n\n\u003Ctownland\u003E {\n wdt:P31 [wd:Q2151232];\n wdt:P17 [wd:Q27 wd:Q145];\n wdt:P625 .;\n wdt:P131 .*;\n wdt:P7959 @\u003Ccounty\u003E;\n wdt:P5097 .;\n wdt:P402 . ;\n wdt:P361 . {0};\n}\n\n\u003Ccounty\u003E EXTRA wdt:P31 {\n wdt:P31 [wd:Q179872 wd:Q1317848];\n}",
12+
"type": "ShExC"
13+
}

tests/fixtures/E297.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"id": "E297",
3+
"serializationVersion": "3.0",
4+
"labels": {
5+
"en": "sailboat class"
6+
},
7+
"descriptions": {
8+
"en": "schema to describe a sailboat class"
9+
},
10+
"aliases": [],
11+
"schemaText": "PREFIX pq: \u003Chttp://www.wikidata.org/prop/qualifier/\u003E\nPREFIX ps: \u003Chttp://www.wikidata.org/prop/statement/\u003E\nPREFIX p: \u003Chttp://www.wikidata.org/prop/\u003E\nPREFIX wd: \u003Chttp://www.wikidata.org/entity/\u003E\nPREFIX wdt: \u003Chttp://www.wikidata.org/prop/direct/\u003E\n\nstart = @\u003Csailboatclass\u003E\n\n\u003Csailboatclass\u003E {\n # Defining properties\n wdt:P31 [wd:Q106179098];\n wdt:P279 @\u003Csubclass\u003E +;\n # Required properties\n wdt:P18 .+;\n wdt:P176 .;\n wdt:P287 .;\n p:P2048 @\u003Cheight\u003E;\n p:P2049 @\u003Cwidth\u003E;\n p:P2043 @\u003Clength1\u003E;\n p:P2043 @\u003Clength2\u003E;\n p:P2067 @\u003Cmass1\u003E;\n p:P2067 @\u003Cmass2\u003E;\n # Optional properties\n wdt:P5962 .*;\n wdt:P2079 .*;\n wdt:P516 .*;\n wdt:P5869 .*;\n}\n \n\u003Csubclass\u003E EXTRA wdt:P31 {\n wdt:P31 [wd:Q16103215];\n}\n\n\u003Clength1\u003E {\n pq:P642 [wd:Q2358152];\n}\n\n\u003Clength2\u003E {\n pq:P642 [wd:Q1817392];\n}\n\n\u003Cwidth\u003E {\n pq:P642 [wd:Q2376482];\n}\n\n\u003Cheight\u003E {\n pq:P642 [wd:Q244777 wd:Q2446632]\n}\n\n\u003Cmass1\u003E {\n pq:P642 [wd:Q5636358]\n}\n\n\u003Cmass2\u003E {\n pq:P642 [wd:Q5461048]\n}",
12+
"type": "ShExC"
13+
}

tests/fixtures/E300.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"id": "E300",
3+
"serializationVersion": "3.0",
4+
"labels": {
5+
"en": "motor racing season"
6+
},
7+
"descriptions": [],
8+
"aliases": [],
9+
"schemaText": "PREFIX rdf: \u003Chttp://www.w3.org/1999/02/22-rdf-syntax-ns#\u003E\nPREFIX rdfs: \u003Chttp://www.w3.org/2000/01/rdf-schema#\u003E\nPREFIX pq: \u003Chttp://www.wikidata.org/prop/qualifier/\u003E\nPREFIX ps: \u003Chttp://www.wikidata.org/prop/statement/\u003E\nPREFIX p: \u003Chttp://www.wikidata.org/prop/\u003E\nPREFIX wd: \u003Chttp://www.wikidata.org/entity/\u003E\nPREFIX wdt: \u003Chttp://www.wikidata.org/prop/direct/\u003E\n\nstart = @\u003Cauto-racing-season\u003E\n\n\u003Cauto-racing-season\u003E {\n wdt:P31 [ wd:Q27020041 ]; # 1 instance of with value sports season\n p:P3450 @\u003Cseason\u003E; # 1 property sports season of league or competition with shape season\n wdt:P641 @\u003Csport\u003E; # 1 sport with any value\n wdt:P585 .; # 1 point in time with any value\n wdt:P1346 .*; # 0 or more winner with any value\n wdt:P1132 .?; # 0 or 1 value no of participants with any value\n wdt:P1350 .?; # 0 or 1 value number of matches played/races/starts with any value\n # Labels\n rdfs:label [@en] + ; # 1 or more labels with a langstring\n}\n\n\u003Cseason\u003E {\n ps:P3450 @\u003Cseason_type\u003E; # 1 statement sports season of league or competition with any value\n pq:P155 .?; # 1 qualifier follows with any value\n pq:P156 .?; # 1 qualifier followed by with any value\n}\n\n\u003Cseason_type\u003E EXTRA wdt:P31 {\n wdt:P31 [ wd:Q60147807 ]; # 1 instance of with value value automobile racing series\n} \n\n\u003Csport\u003E {\n wdt:P279 [ wd:Q5386 ] ; # 1 subclass of with value auto racing\n}",
10+
"type": "ShExC"
11+
}

tests/fixtures/E351.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"id": "E351",
3+
"serializationVersion": "3.0",
4+
"labels": {
5+
"en": "pharmaceutical product"
6+
},
7+
"descriptions": {
8+
"en": "A therapeutical product, usually containing one or more types of compounds as active ingredients."
9+
},
10+
"aliases": [],
11+
"schemaText": "PREFIX wd: \u003Chttp://www.wikidata.org/entity/\u003E\nPREFIX wdt: \u003Chttp://www.wikidata.org/prop/direct/\u003E\n\n#Query for validation: SELECT ?id WHERE {?id wdt:P31 wd:Q28885102 . } LIMIT 10 \n\nstart = @\u003Cpharmaceutical_product\u003E\n\n\u003Cpharmaceutical_product\u003E EXTRA wdt:P31 {\n\twdt:P31 [ wd:Q28885102] ;\n\twdt:P3781 @\u003Cpharmaceutical_product-P3781\u003E + ;\n\twdt:P4044 @\u003Cpharmaceutical_product-P4044\u003E * ;\n\twdt:P3345 . ? ;\n\twdt:P7048 . ? ;\n\twdt:P18 . * ;\n\twdt:P3637 . ? ;\n}\n\n\u003Cpharmaceutical_product-P3781\u003E EXTRA wdt:P31 {\n\twdt:P31 [ wd:Q59199015 wd:Q113145171 wd:Q467717 wd:Q79529] ;\n}\n\n\u003Cpharmaceutical_product-P4044\u003E EXTRA wdt:P31 {\n\twdt:P31 [ wd:Q112193867] ;\n}",
12+
"type": "ShExC"
13+
}

tests/fixtures/E438.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"id": "E438",
3+
"serializationVersion": "3.0",
4+
"labels": {
5+
"en": "Wikimedia Disambiguation Page",
6+
"ja": "ウィキメディアの曖昧さ回避ページ"
7+
},
8+
"descriptions": {
9+
"en": "Entity schema of Wikimedia Disambiguation Page"
10+
},
11+
"aliases": [],
12+
"schemaText": "PREFIX wdt: \u003Chttp://www.wikidata.org/prop/direct/\u003E\nPREFIX wd: \u003Chttp://www.wikidata.org/entity/\u003E\n\nstart = @\u003Cwikimedia-disambiguation-page\u003E\n\n\u003Cwikimedia-disambiguation-page\u003E {\n\twdt:P31 [ wd:Q4167410] ;\n}",
13+
"type": "ShExC"
14+
}

tests/fixtures/E56.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"id": "E56",
3+
"serializationVersion": "3.0",
4+
"labels": {
5+
"da": "dansk udsagnsord",
6+
"en": "Danish verb",
7+
"eo": "dana verbo",
8+
"fr": "verbe danois",
9+
"ja": "デンマーク語の動詞",
10+
"nl": "Deens werkwoord",
11+
"pl": "czasownik duński",
12+
"pt": "verbo (danês)",
13+
"szl": "czasownik duński",
14+
"vec": "verbo danezo"
15+
},
16+
"descriptions": {
17+
"en": "basic schema for Danish verbs",
18+
"fr": "lexème danois",
19+
"ja": "デンマーク語の動詞を記述するための基本的なスキーマ",
20+
"nl": "basisschema voor een Deens werkwoord",
21+
"pl": "podstawowy schemat czasowników duńskich",
22+
"szl": "bazowy schymat czasowników duńskich"
23+
},
24+
"aliases": {
25+
"da": [
26+
"dansk verbum",
27+
"danske verber"
28+
]
29+
},
30+
"schemaText": "IMPORT \u003Chttps://www.wikidata.org/wiki/Special:EntitySchemaText/E15\u003E\nPREFIX E15: \u003Chttps://www.wikidata.org/wiki/Special:EntitySchemaText/E15#\u003E\n\nPREFIX dct: \u003Chttp://purl.org/dc/terms/\u003E\nPREFIX ontolex: \u003Chttp://www.w3.org/ns/lemon/ontolex#\u003E\nPREFIX p: \u003Chttp://www.wikidata.org/prop/\u003E\nPREFIX ps: \u003Chttp://www.wikidata.org/prop/statement/\u003E\nPREFIX rdf: \u003Chttp://www.w3.org/1999/02/22-rdf-syntax-ns#\u003E\nPREFIX wd: \u003Chttp://www.wikidata.org/entity/\u003E\nPREFIX wdno: \u003Chttp://www.wikidata.org/prop/novalue/\u003E\nPREFIX wdt: \u003Chttp://www.wikidata.org/prop/direct/\u003E\nPREFIX wikibase: \u003Chttp://wikiba.se/ontology#\u003E\nPREFIX xsd: \u003Chttp://www.w3.org/2001/XMLSchema#\u003E\n\n# SELECT ?lexeme { ?lexeme dct:language wd:Q9035 ; wikibase:lexicalCategory wd:Q24905 }\n\nstart = @\u003Cdanish-verb\u003E\n\n\u003Cdanish-verb\u003E {\n\n dct:language [ wd:Q9035 ]\n // rdf:label \"Danish language\"\n // rdf:comment \"must be Danish language\" ;\n\n wikibase:lexicalCategory [ wd:Q24905 ]\n // rdf:label \"verb\"\n // rdf:comment \"lexeme must have verb as the lexical category\" ; \n\n\n wdt:P31 IRI +\n # [\n # wd:Q245423 # compound\n # wd:Q493000 # unadapted loanword\n # wd:Q560570 # modal verb\n # wd:Q55773200 # monovalent verb\n # wd:Q112653827 # prefixed-derived word\n # wd:Q1340504 # lexical verb\n # ] *\n // rdf:label \"instance of\"\n // rdf:comment \"zero or more instance of\" ;\n\n wdt:P1343 IRI *\n // rdf:label \"described in\"\n // rdf:comment \"zero or more described in\" ;\n\n wdt:P5323 IRI *\n // rdf:label \"attested in\"\n // rdf:comment \"zero or more attested in\" ;\n\n wdt:P5186 IRI {0,3}\n // rdf:label \"conjugation class\"\n // rdf:comment \"zero or up to three conjugation classes\" ;\n\n wdt:P9295 [ wd:Q116946936 wd:Q116946937 ] {1,2}\n // rdf:label \"transitivity\"\n // rdf:comment \"either transitive or intransitive or both\" ;\n\n wdt:P5187 [ @da ] + \n // rdf:label \"word stem\"\n // rdf:comment \"the word stem must be Danish\" ;\n\n wdt:P5831 [ @da ] + \n // rdf:label \"usage example\"\n // rdf:comment \"one or more usage examples\" ;\n\n wdt:P5401 [ wd:L3828 wd:L5025 ] {1,2}\n // rdf:label \"auxilliary verb\"\n // rdf:comment \"Danish verb must have one or two auxilliary verbs\" ;\n\n wdt:P5238 IRI {0,4}\n // rdf:label \"compound parts\"\n // rdf:comment \"zero or up to four compound parts\" ;\n\n wdt:P5402 IRI *\n // rdf:label \"homograph lexeme\"\n // rdf:comment \"zero or more homograph lexemes\" ;\n\n p:P6140 @E15:dannet-statement \n // rdf:label \"DanNet\"\n // rdf:comment \"DanNet, either a value or novalue\" ; \n\n p:P5912 @E15:oqaasileriffik-statement + \n // rdf:label \"Oqaasileriffik ID\"\n // rdf:comment \"Must have novalue or one or more\" ;\n \n wdt:P12828 xsd:string ?\n // rdf:label \"ID for DAKA\"\n // rdf:comment \"Either one or none ID for DAKA\" ;\n\n wdt:P9529 xsd:string ?\n // rdf:label \"ID for Den Danske Ordbog\"\n // rdf:comment \"Either one or none ID for Den Danske Ordbog\" ;\n\n\n ontolex:lexicalForm @\u003Cdanish-form\u003E + ;\n\n}\nAND {\n # Some verbs might have two conjugation classes as they alternate between them\n wdt:P5186 [\n wd:Q54397142 # First Danish conjugation class\n wd:Q54553380 # Second Danish conjugation class\n wd:Q62494135 # Third Danish conjugation class\n wd:Q62497713 # Fourth a-o-a series\n wd:Q64541795 # Fourth e-a-e series\n wd:Q64541813 # Fourth e-o-e series\n wd:Q64541838 # Fourth e-å-e series\n wd:Q64578156 # Fourth i-a-i series\n wd:Q64347075 # Fourth i-a-u series\n wd:Q64578111 # Fourth i-e-e series\n wd:Q64578756 # Fourth i-e-i series\n wd:Q64580566 # Fourth i-å-i series\n wd:Q64580876 # Fourth y-a-u-series\n wd:Q64580346 # Fourth y-ø-o series\n wd:Q64578184 # Fourth y-ø-y series\n wd:Q64541975 # Fourth y-ø-ø series\n wd:Q64354480 # Fourth æ-a-u series\n wd:Q63860153 # Fourth æ-a-å series\n wd:Q64362028 # Fourth å-i-å series\n wd:Q63860277 # Fourth å-o-å series\n wd:Q64578636 # Fourty same stem vowel\n ] {1,3}\n // rdf:label \"Danish conjugation class\"\n // rdf:comment \"The conjugation class should belong to a restricted set of Danish conjugation classes and some verbs might have two conjugation classes as they alternate between them.\" ; \n }\n OR EXTRA wdt:P31 {\n\n wdt:P31 [ wd:Q465800 wd:Q560570 wd:Q262501 wd:Q49102827 ] + \n // rdf:label \"conjugation class exception\"\n // rdf:comment \"Conjugation class exceptions for auxillary, modal, deponent and reciprocal.\" ; \n\n }\n\n\n\u003Cdanish-form\u003E {\n wikibase:grammaticalFeature IRI+\n}",
31+
"type": "ShExC"
32+
}

0 commit comments

Comments
 (0)