Ticket #5193: bug5193-2.2.patch

File bug5193-2.2.patch, 2.3 KB (added by dustin, 5 years ago)

bug5193-2.patch

  • twisted/persisted/styles.py

    commit bade4ae84e79d574278bab956457c0af8ad20f37
    Author: Dustin J. Mitchell <dustin@zmanda.com>
    Date:   Mon Aug 15 14:28:12 2011 -0500
    
        fix whitespace in _aybabtu, expand and document tests
    
    diff --git a/twisted/persisted/styles.py b/twisted/persisted/styles.py
    index fb85cd9..0744875 100644
    a b def _aybabtu(c): 
    158158    """
    159159    # begin with two classes that should *not* be included in the
    160160    # final result
    161     l = [ c, Versioned ]
     161    l = [c, Versioned]
    162162    for b in inspect.getmro(c):
    163163        if b not in l and issubclass(b, Versioned):
    164164            l.append(b)
  • twisted/test/test_persisted.py

    diff --git a/twisted/test/test_persisted.py b/twisted/test/test_persisted.py
    index 8bbc7d5..7aeb970 100644
    a b class VersionedDiamondSubClass(VersionedSubSubClass, SecondVersionedSubClass): 
    135135
    136136
    137137class AybabtuTests(unittest.TestCase):
     138    """
     139    L{styles._aybabtu} should get all of classes in the inheritance hierarchy
     140    of its argument that are strictly between L{Versioned} and the class
     141    itself.
     142    """
    138143
    139 
    140     def testAybabtu(self):
    141         """
    142         Test styles._aybabtu, including edge cases.
    143         """
     144    def test_aybabtu_strict_empty(self):
     145        """_aybabtu of L{Versioned} itself is an empty set"""
    144146        self.assertEqual(styles._aybabtu(styles.Versioned), [])
     147
     148
     149    def test_aybabtu_strict_subclass(self):
     150        """there are no classes I{between} L{VersionedSubClass} and
     151        L{Versioned}, so L{styles._aybabtu} returns an empty set"""
    145152        self.assertEqual(styles._aybabtu(VersionedSubClass), [])
     153
     154
     155    def test_aybabtu_subsubclass(self):
     156        """With a sub-sub-class of L{Versioned}, L{styles._aybabtu} returns the
     157        intervening subclass."""
    146158        self.assertEqual(styles._aybabtu(VersionedSubSubClass),
    147159            [VersionedSubClass])
     160
     161
     162    def test_aybabtu_strict(self):
     163        """For a diamond-shaped inheritance graph, L{styles._aybabtu} returns
     164        I{both} intermediate subclasses."""
    148165        self.assertEqual(styles._aybabtu(VersionedDiamondSubClass),
    149166            [VersionedSubSubClass, VersionedSubClass, SecondVersionedSubClass])
    150167
    151168
     169
    152170class MyEphemeral(styles.Ephemeral):
    153171
    154172    def __init__(self, x):