Skip to content

Commit

Permalink
fixed and reanbled last trig tests!
Browse files Browse the repository at this point in the history
  • Loading branch information
gromgull committed Dec 22, 2013
1 parent cfc2091 commit e3adce3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
22 changes: 16 additions & 6 deletions rdflib/plugins/parsers/notation3.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,13 @@ def directiveOrStatement(self, argstr, h):
# @@I18N
# _namechars = string.lowercase + string.uppercase + string.digits + '_-'

def tok(self, tok, argstr, i):
def tok(self, tok, argstr, i, colon=False):
"""Check for keyword. Space must have been stripped on entry and
we must not be at end of file."""
we must not be at end of file.
if colon, then keyword followed by colon is ok
(@prefix:<blah> is ok, rdf:type shortcut a must be followed by ws)
"""

assert tok[0] not in _notNameChars # not for punctuation
if argstr[i:i + 1] == "@":
Expand All @@ -491,7 +495,8 @@ def tok(self, tok, argstr, i):
return -1 # No, this has neither keywords declaration nor "@"

if (argstr[i:i + len(tok)] == tok
and (argstr[i + len(tok)] in _notKeywordsChars)):
and ( argstr[i + len(tok)] in _notKeywordsChars)
or (colon and argstr[i+len(tok)] == ':')):
i = i + len(tok)
return i
else:
Expand Down Expand Up @@ -564,7 +569,7 @@ def directive(self, argstr, i):
self._context.declareExistential(x)
return i

j = self.tok('prefix', argstr, i) # no implied "#"
j = self.tok('prefix', argstr, i, colon=True) # no implied "#"
if j >= 0:
t = []
i = self.qname(argstr, j, t)
Expand Down Expand Up @@ -1326,6 +1331,12 @@ def qname(self, argstr, i, res):

if i < len(argstr) and argstr[i] == ':':
pfx = ln
# bnodes names have different rules
if pfx == '_':
allowedChars = _notNameChars
else:
allowedChars = _notQNameChars

i = i + 1
lastslash = False
# start = i # TODO first char .
Expand All @@ -1336,7 +1347,7 @@ def qname(self, argstr, i, res):
lastslash = True
i += 1

elif lastslash or c not in _notQNameChars:
elif lastslash or c not in allowedChars:

if lastslash:
if c not in escapeChars:
Expand Down Expand Up @@ -1413,7 +1424,6 @@ def nodeOrLiteral(self, argstr, i, res):

ch = argstr[i]
if ch in "-+0987654321.":
#import ipdb; ipdb.set_trace()
m = exponent_syntax.match(argstr, i)
if m:
j = m.end()
Expand Down
2 changes: 0 additions & 2 deletions test/test_trig_w3c.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ def trig(test):
}

def test_trig():
from nose import SkipTest
raise SkipTest()
for t in nose_tests(testers, 'test/w3c/trig/manifest.ttl'):
yield t

Expand Down

0 comments on commit e3adce3

Please sign in to comment.