Author: Maciej Fijalkowski <fij...@gmail.com> Branch: Changeset: r51817:0586c5404983 Date: 2012-01-26 22:34 +0200 http://bitbucket.org/pypy/pypy/changeset/0586c5404983/
Log: merge diff --git a/pypy/module/micronumpy/interp_dtype.py b/pypy/module/micronumpy/interp_dtype.py --- a/pypy/module/micronumpy/interp_dtype.py +++ b/pypy/module/micronumpy/interp_dtype.py @@ -90,11 +90,8 @@ return space.newtuple([]) def eq(self, space, w_other): - if space.is_w(self, w_other): - return True - if space.isinstance_w(w_other, space.w_str): - return self.name == space.str_w(w_other) - return False + w_other = space.call_function(space.gettypefor(W_Dtype), w_other) + return space.is_w(self, w_other) def descr_eq(self, space, w_other): return space.wrap(self.eq(space, w_other)) diff --git a/pypy/module/micronumpy/test/test_dtypes.py b/pypy/module/micronumpy/test/test_dtypes.py --- a/pypy/module/micronumpy/test/test_dtypes.py +++ b/pypy/module/micronumpy/test/test_dtypes.py @@ -9,13 +9,18 @@ assert d.num == 0 assert d.kind == 'b' assert dtype('int8').num == 1 - assert dtype('int8') == 'int8' - assert 'int8' == dtype('int8') - assert dtype('int8') != 3 assert dtype(d) is d assert dtype(None) is dtype(float) raises(TypeError, dtype, 1042) + def test_dtype_eq(self): + from _numpypy import dtype + + assert dtype("int8") == "int8" + assert "int8" == dtype("int8") + raises(TypeError, lambda: dtype("int8") == 3) + assert dtype(bool) == bool + def test_dtype_with_types(self): from _numpypy import dtype _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit