Michael Merickel
2016-02-28 cb21ae04bbcc3612704fcc6e5792eb7eb395d059
Merge branch 'pr/1370'
3 files modified
19 ■■■■■ changed files
CONTRIBUTORS.txt 2 ●●●●● patch | view | raw | blame | history
pyramid/config/predicates.py 5 ●●●● patch | view | raw | blame | history
pyramid/tests/test_config/test_predicates.py 12 ●●●●● patch | view | raw | blame | history
CONTRIBUTORS.txt
@@ -247,6 +247,8 @@
- Donald Stufft, 2015/03/15
- Timur Izhbulatov, 2015/04/14
- Karen Dalton, 2015/06/01
- Igor Stroh, 2015/06/10
pyramid/config/predicates.py
@@ -71,7 +71,10 @@
            k = p
            v = None
            if '=' in p:
                k, v = p.split('=', 1)
                if p.startswith('='):
                    k, v = p.rsplit('=', 1)
                else:
                    k, v = p.split('=', 1)
                k, v = k.strip(), v.strip()
            reqs.append((k, v))
        self.val = val
pyramid/tests/test_config/test_predicates.py
@@ -144,6 +144,10 @@
        inst = self._makeOne('abc')
        self.assertEqual(inst.text(), 'request_param abc')
    def test_text_exists_equal_sign(self):
        inst = self._makeOne('=abc')
        self.assertEqual(inst.text(), 'request_param =abc')
    def test_text_withval(self):
        inst = self._makeOne('abc=  1')
        self.assertEqual(inst.text(), 'request_param abc=1')
@@ -152,10 +156,18 @@
        inst = self._makeOne(('abc=  1', 'def'))
        self.assertEqual(inst.text(), 'request_param abc=1,def')
    def test_text_multi_equal_sign(self):
        inst = self._makeOne(('abc=  1', '=def= 2'))
        self.assertEqual(inst.text(), 'request_param =def=2,abc=1')
    def test_phash_exists(self):
        inst = self._makeOne('abc')
        self.assertEqual(inst.phash(), 'request_param abc')
    def test_phash_exists_equal_sign(self):
        inst = self._makeOne('=abc')
        self.assertEqual(inst.phash(), 'request_param =abc')
    def test_phash_withval(self):
        inst = self._makeOne('abc=   1')
        self.assertEqual(inst.phash(), "request_param abc=1")