48
48
49
49
import logging
50
50
import os
51
+ import typing
51
52
52
53
import pytest
53
54
import rdflib .plugins .sparql # type: ignore
64
65
n_uppercase1 = rdflib .URIRef ("urn:example:uppercase1" )
65
66
p_predicate = rdflib .URIRef ("urn:example:predicate1" )
66
67
67
- def test_sparql_syntax_bind_boolean ():
68
+ def test_sparql_syntax_bind_boolean () -> None :
68
69
"""
69
70
This test serves as a syntax reminder for binding boolean values.
70
71
"""
@@ -81,7 +82,7 @@ def test_sparql_syntax_bind_boolean():
81
82
assert confirmed
82
83
83
84
@pytest .mark .xfail (reason = "hard-coded failure" )
84
- def test_pytest_syntax_xfail ():
85
+ def test_pytest_syntax_xfail () -> None :
85
86
"""
86
87
This test serves as a syntax reminder for the XFail decorator.
87
88
"""
@@ -97,7 +98,7 @@ def test_pytest_syntax_xfail():
97
98
confirmed = l_value .toPython ()
98
99
assert confirmed
99
100
100
- def test_sparql_syntax_integer_coercion ():
101
+ def test_sparql_syntax_integer_coercion () -> None :
101
102
"""
102
103
This test serves as a syntax reminder for type coercions.
103
104
"""
@@ -113,7 +114,7 @@ def test_sparql_syntax_integer_coercion():
113
114
confirmed = l_value .toPython ()
114
115
assert confirmed
115
116
116
- def test_sparql_syntax_integer_cast ():
117
+ def test_sparql_syntax_integer_cast () -> None :
117
118
"""
118
119
This test serves as a syntax reminder for the casting form of type coercions.
119
120
"""
@@ -130,7 +131,7 @@ def test_sparql_syntax_integer_cast():
130
131
assert confirmed
131
132
132
133
@pytest .mark .xfail
133
- def test_sparql_cast_custom_type ():
134
+ def test_sparql_cast_custom_type () -> None :
134
135
"""
135
136
This test checks for nonexistent literal-datatype assignments.
136
137
"""
@@ -146,7 +147,7 @@ def test_sparql_cast_custom_type():
146
147
confirmed = l_value .toPython ()
147
148
assert confirmed
148
149
149
- def test_sparql_compare_hexbinary_mixcase ():
150
+ def test_sparql_compare_hexbinary_mixcase () -> None :
150
151
confirmed = None
151
152
graph = rdflib .Graph ()
152
153
for result in graph .query ("""\
@@ -159,7 +160,7 @@ def test_sparql_compare_hexbinary_mixcase():
159
160
confirmed = l_value .toPython ()
160
161
assert confirmed
161
162
162
- def test_sparql_compare_hexbinary_matchcase ():
163
+ def test_sparql_compare_hexbinary_matchcase () -> None :
163
164
confirmed = None
164
165
graph = rdflib .Graph ()
165
166
for result in graph .query ("""\
@@ -172,7 +173,7 @@ def test_sparql_compare_hexbinary_matchcase():
172
173
confirmed = l_value .toPython ()
173
174
assert confirmed
174
175
175
- def test_sparql_compare_hexbinarycanonical_matchcase ():
176
+ def test_sparql_compare_hexbinarycanonical_matchcase () -> None :
176
177
confirmed = None
177
178
graph = rdflib .Graph ()
178
179
for result in graph .query ("""\
@@ -186,7 +187,7 @@ def test_sparql_compare_hexbinarycanonical_matchcase():
186
187
assert confirmed
187
188
188
189
@pytest .mark .xfail
189
- def test_sparql_compare_hexbinarycanonical_mixcase ():
190
+ def test_sparql_compare_hexbinarycanonical_mixcase () -> None :
190
191
"""
191
192
This test shows hexBinaryCanonical does not induce a casing-insensitive comparison.
192
193
"""
@@ -203,7 +204,7 @@ def test_sparql_compare_hexbinarycanonical_mixcase():
203
204
assert confirmed
204
205
205
206
@pytest .mark .xfail
206
- def test_sparql_compare_hb_hbc_mixcase ():
207
+ def test_sparql_compare_hb_hbc_mixcase () -> None :
207
208
"""
208
209
This test confirms that literal-comparison takes into account datatype when one type is unknown.
209
210
"""
@@ -220,7 +221,7 @@ def test_sparql_compare_hb_hbc_mixcase():
220
221
assert confirmed
221
222
222
223
@pytest .mark .xfail
223
- def test_sparql_compare_hb_hbc_mixcase_cast ():
224
+ def test_sparql_compare_hb_hbc_mixcase_cast () -> None :
224
225
"""
225
226
This test is a bit redundant with test_sparql_cast_custom_type, but is here as an explicit demonstration of failure to cast a hexBinary value.
226
227
"""
@@ -236,7 +237,7 @@ def test_sparql_compare_hb_hbc_mixcase_cast():
236
237
confirmed = l_value .toPython ()
237
238
assert confirmed
238
239
239
- def test_rdflib_literal_hexbinary ():
240
+ def test_rdflib_literal_hexbinary () -> None :
240
241
_logger .debug ("l_hb_lowercase = %r." % l_hb_lowercase )
241
242
_logger .debug ("l_hb_uppercase = %r." % l_hb_uppercase )
242
243
_logger .debug ("l_hb_lowercase.toPython() = %r." % l_hb_lowercase .toPython ())
@@ -249,20 +250,20 @@ def test_rdflib_literal_hexbinary():
249
250
assert l_hb_lowercase .toPython () == l_hb_uppercase .toPython ()
250
251
251
252
@pytest .mark .xfail
252
- def test_rdflib_literal_hexbinarycanonical ():
253
+ def test_rdflib_literal_hexbinarycanonical () -> None :
253
254
_logger .debug ("l_hb_uppercase = %r." % l_hb_uppercase )
254
255
_logger .debug ("l_hbc_uppercase = %r." % l_hbc_uppercase )
255
256
256
257
assert l_hb_uppercase == l_hbc_uppercase
257
258
258
259
@pytest .mark .xfail
259
- def test_rdflib_literal_topython_hexbinarycanonical ():
260
+ def test_rdflib_literal_topython_hexbinarycanonical () -> None :
260
261
_logger .debug ("l_hb_lowercase.toPython() = %r." % l_hb_lowercase .toPython ())
261
262
_logger .debug ("l_hb_uppercase.toPython() = %r." % l_hb_uppercase .toPython ())
262
263
263
264
assert l_hb_uppercase .toPython () == l_hbc_uppercase .toPython ()
264
265
265
- def _query_all_value_matches (graph ):
266
+ def _query_all_value_matches (graph ) -> typing . Set [ str ] :
266
267
"""
267
268
Return set of all node names (as strings) that have a matching value, where
268
269
"matching" is determined by the SPARQL engine's type and data coercions.
@@ -280,7 +281,7 @@ def _query_all_value_matches(graph):
280
281
computed .add (n_node2 .toPython ())
281
282
return computed
282
283
283
- def test_graph_repeat ():
284
+ def test_graph_repeat () -> None :
284
285
"""
285
286
Two nodes are given the same literal value, and are found to match on literal values.
286
287
"""
@@ -302,7 +303,7 @@ def test_graph_repeat():
302
303
computed = _query_all_value_matches (graph )
303
304
assert computed == expected
304
305
305
- def test_graph_all_hexbinary_literals ():
306
+ def test_graph_all_hexbinary_literals () -> None :
306
307
"""
307
308
Two nodes with the same literal value, and another node with the uppercase of the literal hexBinary value, are found to match on literal values.
308
309
"""
@@ -333,7 +334,7 @@ def test_graph_all_hexbinary_literals():
333
334
assert computed == expected
334
335
335
336
@pytest .mark .xfail
336
- def test_graph_hexbinarycanonical ():
337
+ def test_graph_hexbinarycanonical () -> None :
337
338
graph = rdflib .Graph ()
338
339
graph .add ((
339
340
n_lowercase1 ,
0 commit comments