-
Notifications
You must be signed in to change notification settings - Fork 565
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1806 from gjhiggins/migrate-more-tests-to-pytest
Migrate more tests to pytest Merging with only one review as this is a fairly straight forward migration to pytest and coverage remains the same.
- Loading branch information
Showing
16 changed files
with
168 additions
and
286 deletions.
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
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
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 |
---|---|---|
@@ -1,36 +1,29 @@ | ||
import unittest | ||
|
||
from rdflib import Literal | ||
from rdflib.namespace import XSD | ||
|
||
|
||
class NormalizedStringTest(unittest.TestCase): | ||
class TestNormalizedString: | ||
def test1(self): | ||
lit2 = Literal("\two\nw", datatype=XSD.normalizedString) | ||
lit = Literal("\two\nw", datatype=XSD.string) | ||
self.assertFalse(str(lit) == str(lit2)) | ||
assert str(lit) != str(lit2) | ||
|
||
def test2(self): | ||
lit = Literal( | ||
"\tBeing a Doctor Is\n\ta Full-Time Job\r", datatype=XSD.normalizedString | ||
) | ||
st = Literal(" Being a Doctor Is a Full-Time Job ", datatype=XSD.string) | ||
self.assertFalse(Literal.eq(st, lit)) | ||
self.assertEqual(str(lit), str(st)) | ||
assert Literal.eq(st, lit) is False | ||
assert str(lit) == str(st) | ||
|
||
def test3(self): | ||
lit = Literal("hey\nthere", datatype=XSD.normalizedString).n3() | ||
self.assertTrue( | ||
lit == '"hey there"^^<http://www.w3.org/2001/XMLSchema#normalizedString>' | ||
) | ||
assert lit == '"hey there"^^<http://www.w3.org/2001/XMLSchema#normalizedString>' | ||
|
||
def test4(self): | ||
lit = Literal( | ||
"hey\nthere\ta tab\rcarriage return", datatype=XSD.normalizedString | ||
) | ||
expected = Literal("""hey there a tab carriage return""", datatype=XSD.string) | ||
self.assertEqual(str(lit), str(expected)) | ||
|
||
assert str(lit) == str(expected) | ||
|
||
if __name__ == "__main__": | ||
unittest.main() |
Oops, something went wrong.