[issue19265] Increased test coverage for datetime pickling

Alexander Belopolsky report at bugs.python.org
Sat Oct 19 07:49:17 CEST 2013


Alexander Belopolsky added the comment:

I guess the extra coverage is in "if getstate" branch of

class tzinfo:
    ...
    def __reduce__(self):
        getinitargs = getattr(self, "__getinitargs__", None)
        if getinitargs:
            args = getinitargs()
        else:
            args = ()
        getstate = getattr(self, "__getstate__", None)
        if getstate:
            state = getstate()
        else:
            state = getattr(self, "__dict__", None) or None
        if state is None:
            return (self.__class__, args)
        else:
            return (self.__class__, args, state)

The other branch is probably covered by timezone class tests.  The patch looks good to me.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19265>
_______________________________________


More information about the Python-bugs-list mailing list