diff options
| author | Ilja Everilä <saarni@gmail.com> | 2015-02-05 20:48:54 +0200 |
|---|---|---|
| committer | Ilja Everilä <saarni@gmail.com> | 2015-02-05 20:48:54 +0200 |
| commit | d49949081da1669914ddebb487c87edba3f41000 (patch) | |
| tree | 3124a68039d389d7fcc671bcf3001ad38307c424 | |
| parent | 0ccb82204b8d04f8ffeb8b49a94fb77f981d1122 (diff) | |
| download | pyramid-d49949081da1669914ddebb487c87edba3f41000.tar.gz pyramid-d49949081da1669914ddebb487c87edba3f41000.tar.bz2 pyramid-d49949081da1669914ddebb487c87edba3f41000.zip | |
ugly nop dict update hack for PY2 and coverage
| -rw-r--r-- | pyramid/tests/test_config/test_util.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/pyramid/tests/test_config/test_util.py b/pyramid/tests/test_config/test_util.py index c9b0e9e9b..0d0de9579 100644 --- a/pyramid/tests/test_config/test_util.py +++ b/pyramid/tests/test_config/test_util.py @@ -568,13 +568,12 @@ class Test_takes_one_arg(unittest.TestCase): foo = Foo() self.assertTrue(self._callFUT(foo.method)) - if PY3: - def test_function_annotations(self): - def foo(bar): - """ """ - # avoid SyntaxErrors in python2 - foo.__annotations__.update({'bar': 'baz'}) - self.assertTrue(self._callFUT(foo)) + def test_function_annotations(self): + def foo(bar): + """ """ + # avoid SyntaxErrors in python2, this if effectively nop + getattr(foo, '__annotations__', {}).update({'bar': 'baz'}) + self.assertTrue(self._callFUT(foo)) class TestNotted(unittest.TestCase): def _makeOne(self, predicate): |
