[Zodb-checkins] CVS: Zope/lib/python/persistent/tests - test_pickle.py:1.5 test_overriding_attrs.py:1.3

Jeremy Hylton jeremy at zope.com
Thu Feb 19 13:14:06 EST 2004


Update of /cvs-repository/Zope/lib/python/persistent/tests
In directory cvs.zope.org:/tmp/cvs-serv18802/lib/python/persistent/tests

Modified Files:
	test_pickle.py test_overriding_attrs.py 
Log Message:
Backport Fred's recent changes from the branch.

- fold in not-actually-shared pickle support code into cPersistence.c,
  removing pickle.c
- remove __getnewargs__(), since we want to allow ghost creation to
  avoid the extra database lookup when possible
- persistent objects no longer get a default __getnewargs__()


=== Zope/lib/python/persistent/tests/test_pickle.py 1.4 => 1.5 ===
--- Zope/lib/python/persistent/tests/test_pickle.py:1.4	Wed Feb 18 21:59:32 2004
+++ Zope/lib/python/persistent/tests/test_pickle.py	Thu Feb 19 13:13:34 2004
@@ -50,9 +50,6 @@
     """
     >>> x = Simple('x', aaa=1, bbb='foo')
 
-    >>> x.__getnewargs__()
-    ()
-
     >>> print_dict(x.__getstate__())
     {'__name__': 'x', 'aaa': 1, 'bbb': 'foo'}
 
@@ -152,9 +149,6 @@
     """
     >>> x = SubSlotted('x', 'y', 'z')
 
-    >>> x.__getnewargs__()
-    ()
-
     >>> d, s = x.__getstate__()
     >>> d
     >>> print_dict(s)
@@ -206,9 +200,6 @@
     """
     >>> x = SubSubSlotted('x', 'y', 'z', aaa=1, bbb='foo')
 
-    >>> x.__getnewargs__()
-    ()
-
     >>> d, s = x.__getstate__()
     >>> print_dict(d)
     {'aaa': 1, 'bbb': 'foo'}
@@ -248,9 +239,6 @@
 def test_pickling_w_slots_w_empty_dict():
     """
     >>> x = SubSubSlotted('x', 'y', 'z')
-
-    >>> x.__getnewargs__()
-    ()
 
     >>> d, s = x.__getstate__()
     >>> print_dict(d)


=== Zope/lib/python/persistent/tests/test_overriding_attrs.py 1.2 => 1.3 ===
--- Zope/lib/python/persistent/tests/test_overriding_attrs.py:1.2	Wed Feb 18 21:59:32 2004
+++ Zope/lib/python/persistent/tests/test_overriding_attrs.py	Thu Feb 19 13:13:34 2004
@@ -74,7 +74,11 @@
 
         >>> db.close()
         """
-        return name.upper(), self._p_changed
+        # Don't pretend we have any special attributes.
+        if name.startswith("__") and name.endswrith("__"):
+            raise AttributeError, name
+        else:
+            return name.upper(), self._p_changed
 
 class SampleOverridingGetattributeSetattrAndDelattr(Persistent):
     """Example of overriding __getattribute__, __setattr__, and __delattr__




More information about the Zodb-checkins mailing list