[svn r37425] Fixed Code.__ne__() (wrong function sig, missing 'other' argument).

--HG--
branch : trunk
This commit is contained in:
guido 2007-01-27 13:29:39 +01:00
parent d929f633a7
commit 9539e49743
2 changed files with 7 additions and 1 deletions

View File

@ -15,7 +15,7 @@ class Code(object):
def __eq__(self, other):
return self.raw == other.raw
def __ne__(self):
def __ne__(self, other):
return not self == other
def new(self, rec=False, **kwargs):

View File

@ -8,6 +8,12 @@ def test_newcode():
newco = code.new()
assert co == newco
def test_ne():
code1 = py.code.Code(compile('foo = "bar"', '', 'exec'))
assert code1 == code1
code2 = py.code.Code(compile('foo = "baz"', '', 'exec'))
assert code2 != code1
def test_newcode_unknown_args():
code = py.code.Code(compile("", '', 'exec'))
py.test.raises(TypeError, 'code.new(filename="hello")')