Skip to content

Commit

Permalink
Fix python2 test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
sethrh committed Mar 22, 2016
1 parent 9914ab5 commit 60e26e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 6 additions & 0 deletions jsonrpc/tests/p3_test_code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Python3-only code
# This won't even parse in python2, so it's kept in a separate file and imported
# when needed.

def distance(a: float, b: float) -> float:
return (a**2 + b**2)**0.5
7 changes: 5 additions & 2 deletions jsonrpc/tests/test_pep3107.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import unittest
import sys
from manager import JSONRPCResponseManager

if sys.version_info[0] < 3:
sys.exit(0)

from p3_test_code import distance

class TestJSONRPCResponseManager(unittest.TestCase):
def test_typeerror_with_annotations(self):
"""If a function has Python3 annotations and is called with improper
arguments, make sure the framework doesn't fail with inspect.getargspec
"""
def distance(a: float, b: float) -> float:
return (a**2 + b**2)**0.5

dispatcher = {
"distance": distance,
Expand Down

0 comments on commit 60e26e3

Please sign in to comment.