Skip to content

Commit

Permalink
reformat edited files using black
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianLudwig committed Oct 23, 2020
1 parent 2a2bb0d commit 7c1d49b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions rdflib/plugins/sparql/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,8 +1003,7 @@ def date(e) -> py_datetime.date:
if not isinstance(e, Literal):
raise SPARQLError("Non-literal passed as date: %r" % e)
if e.datatype not in (XSD.date, XSD.dateTime):
raise SPARQLError(
"Literal with wrong datatype passed as date: %r" % e)
raise SPARQLError("Literal with wrong datatype passed as date: %r" % e)
result = e.toPython()
if isinstance(result, py_datetime.datetime):
return result.date()
Expand Down
4 changes: 2 additions & 2 deletions test/test_sparql_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ def test_datetime_cast():
result = operators.datetime(literal)
assert isinstance(result, datetime.datetime)
assert result == now


@nose.tools.raises(sparql.SPARQLError)
def test_datetime_cast_type_error():
literal = rdflib.Literal("2020-01-02")
operators.date(literal)
operators.date(literal)

0 comments on commit 7c1d49b

Please sign in to comment.