assert reinterpretation: try mangling attributes that look like private class vars (fixes #514)

This commit is contained in:
Benjamin Peterson
2014-05-31 14:37:02 -07:00
parent fd4b461290
commit 780bdda95a
4 changed files with 39 additions and 2 deletions

View File

@@ -131,6 +131,18 @@ def test_assert_keyword_arg():
e = exvalue()
assert "x=5" in e.msg
def test_private_class_variable():
class X:
def __init__(self):
self.__v = 41
def m(self):
assert self.__v == 42
try:
X().m()
except AssertionError:
e = exvalue()
assert "== 42" in e.msg
# These tests should both fail, but should fail nicely...
class WeirdRepr:
def __repr__(self):