diff options
| author | Michael Merickel <michael@merickel.org> | 2018-10-15 01:55:54 -0500 |
|---|---|---|
| committer | Michael Merickel <michael@merickel.org> | 2018-10-15 09:24:07 -0500 |
| commit | 0c29cf2df41600d3906d521c72991c7686018b71 (patch) | |
| tree | ff907f90ec9467e12874c9b2c961549d0e7caf74 /tests/test_location.py | |
| parent | 851c368e3c158e264358de10446f5b5de240e534 (diff) | |
| download | pyramid-0c29cf2df41600d3906d521c72991c7686018b71.tar.gz pyramid-0c29cf2df41600d3906d521c72991c7686018b71.tar.bz2 pyramid-0c29cf2df41600d3906d521c72991c7686018b71.zip | |
format source using black
Diffstat (limited to 'tests/test_location.py')
| -rw-r--r-- | tests/test_location.py | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/tests/test_location.py b/tests/test_location.py index e1f47f4ab..b48b7bdaa 100644 --- a/tests/test_location.py +++ b/tests/test_location.py @@ -1,15 +1,20 @@ import unittest + class TestInside(unittest.TestCase): def _callFUT(self, one, two): from pyramid.location import inside + return inside(one, two) - + def test_inside(self): o1 = Location() - o2 = Location(); o2.__parent__ = o1 - o3 = Location(); o3.__parent__ = o2 - o4 = Location(); o4.__parent__ = o3 + o2 = Location() + o2.__parent__ = o1 + o3 = Location() + o3.__parent__ = o2 + o4 = Location() + o4.__parent__ = o3 self.assertEqual(self._callFUT(o1, o1), True) self.assertEqual(self._callFUT(o2, o1), True) @@ -18,23 +23,31 @@ class TestInside(unittest.TestCase): self.assertEqual(self._callFUT(o1, o4), False) self.assertEqual(self._callFUT(o1, None), False) + class TestLineage(unittest.TestCase): def _callFUT(self, context): from pyramid.location import lineage + return lineage(context) def test_lineage(self): o1 = Location() - o2 = Location(); o2.__parent__ = o1 - o3 = Location(); o3.__parent__ = o2 - o4 = Location(); o4.__parent__ = o3 + o2 = Location() + o2.__parent__ = o1 + o3 = Location() + o3.__parent__ = o2 + o4 = Location() + o4.__parent__ = o3 result = list(self._callFUT(o3)) self.assertEqual(result, [o3, o2, o1]) result = list(self._callFUT(o1)) self.assertEqual(result, [o1]) + from pyramid.interfaces import ILocation from zope.interface import implementer + + @implementer(ILocation) class Location(object): __name__ = __parent__ = None |
