From 9539e49743a41d8e260ff73962fe394c3929be30 Mon Sep 17 00:00:00 2001 From: guido Date: Sat, 27 Jan 2007 13:29:39 +0100 Subject: [PATCH] [svn r37425] Fixed Code.__ne__() (wrong function sig, missing 'other' argument). --HG-- branch : trunk --- py/code/code.py | 2 +- py/code/testing/test_code.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/py/code/code.py b/py/code/code.py index a01984383..6e1adc403 100644 --- a/py/code/code.py +++ b/py/code/code.py @@ -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): diff --git a/py/code/testing/test_code.py b/py/code/testing/test_code.py index c2b0ff978..ae2fbb93a 100644 --- a/py/code/testing/test_code.py +++ b/py/code/testing/test_code.py @@ -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")')