Show final value first when explaining an attribute

Then show the expansion as a "where" part of the explanation.

--HG--
branch : trunk
This commit is contained in:
Floris Bruynooghe
2010-10-06 18:20:09 +01:00
parent c62ed0cd93
commit ec5ea5c05e
4 changed files with 55 additions and 1 deletions

View File

@@ -81,6 +81,27 @@ def test_is():
s = str(e)
assert s.startswith("assert 1 is 2")
def test_attrib():
class Foo(object):
b = 1
i = Foo()
try:
assert i.b == 2
except AssertionError:
e = exvalue()
s = str(e)
assert s.startswith("assert 1 == 2")
def test_attrib_inst():
class Foo(object):
b = 1
try:
assert Foo().b == 2
except AssertionError:
e = exvalue()
s = str(e)
assert s.startswith("assert 1 == 2")
def test_assert_non_string_message():
class A:
def __str__(self):