Author: Amaury Forgeot d'Arc <amaur...@gmail.com> Branch: py3.5 Changeset: r88154:6c4f77baa08a Date: 2016-11-06 17:45 +0100 http://bitbucket.org/pypy/pypy/changeset/6c4f77baa08a/
Log: SimpleNamespace.__eq__ diff --git a/pypy/module/sys/app.py b/pypy/module/sys/app.py --- a/pypy/module/sys/app.py +++ b/pypy/module/sys/app.py @@ -126,6 +126,10 @@ finally: recurse.remove(ident) + def __eq__(self, other): + return (isinstance(other, SimpleNamespace) and + self.__dict__ == other.__dict__) + # This class is not exposed in sys, but by the types module. SimpleNamespace.__module__ = 'types' diff --git a/pypy/module/sys/test/test_sysmodule.py b/pypy/module/sys/test/test_sysmodule.py --- a/pypy/module/sys/test/test_sysmodule.py +++ b/pypy/module/sys/test/test_sysmodule.py @@ -595,7 +595,7 @@ SimpleNamespace = type(sys.implementation) ns = SimpleNamespace(x=1, y=2, w=3) copy = pickle.loads(pickle.dumps(ns)) - copy.__dict__ == dict(x=1, y=2, w=3, z=4) + assert copy == ns def test_reload_doesnt_override_sys_executable(self): import sys _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit