Skip to content

Commit

Permalink
pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
hannosch committed May 5, 2013
1 parent 561062c commit a731ca9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 25 deletions.
28 changes: 7 additions & 21 deletions src/Persistence/tests/test_mapping.py
@@ -1,25 +1,10 @@
##############################################################################
#
# Copyright (c) 2003 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""
$Id$
"""
import unittest
from doctest import DocTestSuite
from Persistence import PersistentMapping
import unittest


def test_basic_functionality():
"""
>>> from Persistence import PersistentMapping
>>> m = PersistentMapping({'x': 1}, a=2, b=3)
>>> m['name'] = 'bob'
>>> m['fred']
Expand Down Expand Up @@ -68,21 +53,22 @@ def test_basic_functionality():
>>> 'name' in m
True
"""


def test_old_pickles():
"""
>>> from Persistence import PersistentMapping
>>> m = PersistentMapping()
>>> m.__setstate__({'_container': {'x': 1, 'y': 2}})
>>> items = m.items()
>>> items.sort()
>>> items
[('x', 1), ('y', 2)]
"""


def test_suite():
return unittest.TestSuite((
DocTestSuite(),
))
))
10 changes: 6 additions & 4 deletions src/Persistence/tests/test_persistent.py
Expand Up @@ -60,9 +60,11 @@ def setstate(self, obj):
# but it suffices for the tests.
obj.__class__.__init__(obj)


class P(Persistent):
pass


class H1(Persistent):

def __init__(self):
Expand All @@ -72,6 +74,7 @@ def __getattr__(self, attr):
self.n += 1
return self.n


class H2(Persistent):

def __init__(self):
Expand All @@ -86,6 +89,7 @@ def __getattribute__(self, attr):
self.n = n + 1
return n + 1


class PersistenceTest(unittest.TestCase):

def setUp(self):
Expand All @@ -107,13 +111,15 @@ def testOidAndJarAttrs(self):
def deloid():
del obj._p_oid
self.assertRaises(ValueError, deloid)

def setoid():
obj._p_oid = 12
self.assertRaises(ValueError, setoid)

def deloid():
del obj._p_jar
self.assertRaises(ValueError, deloid)

def setoid():
obj._p_jar = 12
self.assertRaises(ValueError, setoid)
Expand Down Expand Up @@ -225,7 +231,3 @@ def testGetattribute(self):

# TODO: Need to decide how __setattr__ and __delattr__ should work,
# then write tests.


def test_suite():
return unittest.makeSuite(PersistenceTest)

0 comments on commit a731ca9

Please sign in to comment.