Fork of https://github.com/oxigraph/oxigraph.git for the purpose of NextGraph project
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.1 KiB
33 lines
1.1 KiB
import unittest
|
|
from rudf import *
|
|
|
|
XSD_STRING = NamedNode('http://www.w3.org/2001/XMLSchema#string')
|
|
XSD_INTEGER = NamedNode('http://www.w3.org/2001/XMLSchema#integer')
|
|
RDF_LANG_STRING = NamedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#langString')
|
|
|
|
|
|
class TestNamedNode(unittest.TestCase):
|
|
def test_constructor(self):
|
|
self.assertEqual(NamedNode('http://foo').value(), 'http://foo/')
|
|
|
|
|
|
class TestBlankNode(unittest.TestCase):
|
|
def test_constructor(self):
|
|
self.assertNotEqual(BlankNode(), BlankNode())
|
|
|
|
|
|
class TestLiteral(unittest.TestCase):
|
|
def test_constructor(self):
|
|
self.assertEqual(Literal('foo').value(), 'foo')
|
|
self.assertEqual(Literal('foo').datatype(), XSD_STRING)
|
|
|
|
self.assertEqual(Literal('foo', 'en').value(), 'foo')
|
|
self.assertEqual(Literal('foo', 'en').language(), 'en')
|
|
self.assertEqual(Literal('foo', 'en').datatype(), RDF_LANG_STRING)
|
|
|
|
self.assertEqual(Literal('foo', datatype=XSD_INTEGER).value(), 'foo')
|
|
self.assertEqual(Literal('foo', datatype=XSD_INTEGER).datatype(), XSD_INTEGER)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|
|
|