-
Notifications
You must be signed in to change notification settings - Fork 556
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove extra newline from N-Triples output (#1999)
Remove the extra newline generated by the N-Triples serializer and add a unit test to verify that N-Triples output does not end in two consecutive newlines. Closes #1998
- Loading branch information
1 parent
4f96f46
commit eabab5f
Showing
2 changed files
with
15 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
"""Test that N-Triples formats do not have double newlines at the end | ||
of the output. | ||
https://github.com/RDFLib/rdflib/issues/1998 | ||
""" | ||
import rdflib | ||
|
||
|
||
def test_1998(): | ||
g = rdflib.Graph() | ||
bob = rdflib.URIRef("http://example.org/people/Bob") | ||
g.add((bob, rdflib.RDF.type, rdflib.FOAF.Person)) | ||
for nt_format in ("nt", "nt11"): | ||
output = g.serialize(format=nt_format) | ||
assert not output.endswith("\n\n") |