From adf32395eaef658bc9053037a9bed4b182397faf Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 5 Aug 2012 23:58:32 -0400 Subject: add coverage, get rid of test that doesnt belong here --- pyramid/tests/test_config/test_init.py | 3 --- pyramid/tests/test_config/test_util.py | 32 +++++++++++++++++++++++--------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/pyramid/tests/test_config/test_init.py b/pyramid/tests/test_config/test_init.py index 3d952caf7..abe22400b 100644 --- a/pyramid/tests/test_config/test_init.py +++ b/pyramid/tests/test_config/test_init.py @@ -1994,6 +1994,3 @@ class DummyIntrospectable(object): def register(self, introspector, action_info): self.registered.append((introspector, action_info)) -class DummyPredicateList(object): - def add(self, name, factory, weighs_more_than=None, weighs_less_than=None): - pass diff --git a/pyramid/tests/test_config/test_util.py b/pyramid/tests/test_config/test_util.py index 310d04535..13cb27526 100644 --- a/pyramid/tests/test_config/test_util.py +++ b/pyramid/tests/test_config/test_util.py @@ -361,15 +361,10 @@ class TestPredicateList(unittest.TestCase): hash2, _, __= self._callFUT(request_method='GET') self.assertEqual(hash1, hash2) - def test_match_param_hashable(self): - # https://github.com/Pylons/pyramid/issues/425 - import pyramid.testing - def view(request): pass - config = pyramid.testing.setUp(autocommit=False) - config.add_route('foo', '/foo/{a}/{b}') - config.add_view(view, route_name='foo', match_param='a=bar') - config.add_view(view, route_name='foo', match_param=('a=bar', 'b=baz')) - config.commit() + def test_unknown_predicate(self): + from pyramid.exceptions import ConfigurationError + self.assertRaises(ConfigurationError, self._callFUT, unknown=1) + class TestActionInfo(unittest.TestCase): def _getTargetClass(self): @@ -406,6 +401,25 @@ class TestTopologicalSorter(unittest.TestCase): from pyramid.config.util import TopologicalSorter return TopologicalSorter(*arg, **kw) + def test_remove(self): + inst = self._makeOne() + inst.names.append('name') + inst.name2val['name'] = 1 + inst.req_after.add('name') + inst.req_before.add('name') + inst.name2after['name'] = ('bob',) + inst.name2before['name'] = ('fred',) + inst.order.append(('bob', 'name')) + inst.order.append(('name', 'fred')) + inst.remove('name') + self.assertFalse(inst.names) + self.assertFalse(inst.req_before) + self.assertFalse(inst.req_after) + self.assertFalse(inst.name2before) + self.assertFalse(inst.name2after) + self.assertFalse(inst.name2val) + self.assertFalse(inst.order) + def test_add(self): from pyramid.config.util import LAST sorter = self._makeOne() -- cgit v1.2.3