fixes issue113 - assertion represenation issue
--HG-- branch : trunk
This commit is contained in:
parent
92bfb58798
commit
efeae72509
|
@ -1,6 +1,8 @@
|
|||
Changes between 1.3.2 and 1.3.3a1
|
||||
==================================================
|
||||
|
||||
- fix issue113: assertion representation problem with triple-quoted strings
|
||||
(and possibly other cases)
|
||||
- make conftest loading detect that a conftest file with the same
|
||||
content was already loaded, avoids surprises in nested directory structures
|
||||
that can be produced e.g. by Hudson. It alleviates the need to use
|
||||
|
|
|
@ -125,16 +125,13 @@ class Source(object):
|
|||
try:
|
||||
compile_command(trysource)
|
||||
except (SyntaxError, OverflowError, ValueError):
|
||||
pass
|
||||
else:
|
||||
break # got a valid or incomplete statement
|
||||
continue
|
||||
|
||||
# 2. find the end of the statement
|
||||
for end in range(lineno+1, len(self)+1):
|
||||
trysource = self[start:end]
|
||||
if trysource.isparseable():
|
||||
break
|
||||
|
||||
return start, end
|
||||
return start, end
|
||||
|
||||
def getblockend(self, lineno):
|
||||
|
|
|
@ -176,6 +176,13 @@ class TestSourceParsingAndCompiling:
|
|||
#x = s.deindent()
|
||||
assert str(s) == ass
|
||||
|
||||
def test_getstatementrange_triple_quoted(self):
|
||||
#print str(self.source)
|
||||
source = Source("""'''
|
||||
'''""")
|
||||
s = source.getstatement(1)
|
||||
assert eval(str(s))
|
||||
|
||||
def test_getstatementrange_within_constructs(self):
|
||||
source = Source("""\
|
||||
try:
|
||||
|
|
|
@ -9,6 +9,17 @@ def test_functional(testdir):
|
|||
result = testdir.runpytest("--no-assert")
|
||||
assert "3 == 4" not in result.stdout.str()
|
||||
|
||||
def test_triple_quoted_string_issue113(testdir):
|
||||
testdir.makepyfile("""
|
||||
def test_hello():
|
||||
assert "" == '''
|
||||
'''""")
|
||||
result = testdir.runpytest("--fulltrace")
|
||||
result.stdout.fnmatch_lines([
|
||||
"*1 failed*",
|
||||
])
|
||||
assert 'SyntaxError' not in result.stdout.str()
|
||||
|
||||
def test_traceback_failure(testdir):
|
||||
p1 = testdir.makepyfile("""
|
||||
def g():
|
||||
|
|
Loading…
Reference in New Issue