fix interpreting is/is not/in/not in
--HG-- branch : trunk
This commit is contained in:
parent
ac934bb2b6
commit
0014e65c1d
|
@ -68,6 +68,10 @@ operator_map = {
|
||||||
ast.LtE : "<=",
|
ast.LtE : "<=",
|
||||||
ast.Gt : ">",
|
ast.Gt : ">",
|
||||||
ast.GtE : ">=",
|
ast.GtE : ">=",
|
||||||
|
ast.Is : "is",
|
||||||
|
ast.IsNot : "is not",
|
||||||
|
ast.In : "in",
|
||||||
|
ast.NotIn : "not in"
|
||||||
}
|
}
|
||||||
|
|
||||||
unary_map = {
|
unary_map = {
|
||||||
|
|
|
@ -65,6 +65,22 @@ def test_assert_multiline_2():
|
||||||
s = str(e)
|
s = str(e)
|
||||||
assert s.startswith('assert 2 ==')
|
assert s.startswith('assert 2 ==')
|
||||||
|
|
||||||
|
def test_in():
|
||||||
|
try:
|
||||||
|
assert "hi" in [1, 2]
|
||||||
|
except AssertionError:
|
||||||
|
e = exvalue()
|
||||||
|
s = str(e)
|
||||||
|
assert s.startswith("assert 'hi' in")
|
||||||
|
|
||||||
|
def test_is():
|
||||||
|
try:
|
||||||
|
assert 1 is 2
|
||||||
|
except AssertionError:
|
||||||
|
e = exvalue()
|
||||||
|
s = str(e)
|
||||||
|
assert s.startswith("assert 1 is 2")
|
||||||
|
|
||||||
def test_assert_non_string_message():
|
def test_assert_non_string_message():
|
||||||
class A:
|
class A:
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
Loading…
Reference in New Issue