-
Notifications
You must be signed in to change notification settings - Fork 4.5k
[BEAM-5663] Add Python 3.6 tox environment #7988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,20 +34,32 @@ class TrivialInferenceTest(unittest.TestCase): | |
| def assertReturnType(self, expected, f, inputs=()): | ||
| self.assertEquals(expected, trivial_inference.infer_return_type(f, inputs)) | ||
|
|
||
| @unittest.skipIf(sys.version_info >= (3, 6, 0) and | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It may be easier to move the skip declaration to skip entire |
||
| os.environ.get('RUN_SKIPPED_PY3_TESTS') != '1', | ||
| 'This test still needs to be fixed on Python 3.6.') | ||
| def testIdentity(self): | ||
| self.assertReturnType(int, lambda x: x, [int]) | ||
|
|
||
| @unittest.skipIf(sys.version_info >= (3, 6, 0) and | ||
| os.environ.get('RUN_SKIPPED_PY3_TESTS') != '1', | ||
| 'This test still needs to be fixed on Python 3.6.') | ||
| def testIndexing(self): | ||
| self.assertReturnType(int, lambda x: x[0], [typehints.Tuple[int, str]]) | ||
| self.assertReturnType(str, lambda x: x[1], [typehints.Tuple[int, str]]) | ||
| self.assertReturnType(str, lambda x: x[1], [typehints.List[str]]) | ||
|
|
||
| @unittest.skipIf(sys.version_info >= (3, 6, 0) and | ||
| os.environ.get('RUN_SKIPPED_PY3_TESTS') != '1', | ||
| 'This test still needs to be fixed on Python 3.6.') | ||
| def testTuples(self): | ||
| self.assertReturnType( | ||
| typehints.Tuple[typehints.Tuple[()], int], lambda x: ((), x), [int]) | ||
| self.assertReturnType( | ||
| typehints.Tuple[str, int, float], lambda x: (x, 0, 1.0), [str]) | ||
|
|
||
| @unittest.skipIf(sys.version_info >= (3, 6, 0) and | ||
| os.environ.get('RUN_SKIPPED_PY3_TESTS') != '1', | ||
| 'This test still needs to be fixed on Python 3.6.') | ||
| def testGetItem(self): | ||
| def reverse(ab): | ||
| return ab[-1], ab[0] | ||
|
|
@@ -62,6 +74,9 @@ def reverse(ab): | |
| self.assertReturnType( | ||
| typehints.List[int], lambda v: v[::-1], [typehints.List[int]]) | ||
|
|
||
| @unittest.skipIf(sys.version_info >= (3, 6, 0) and | ||
| os.environ.get('RUN_SKIPPED_PY3_TESTS') != '1', | ||
| 'This test still needs to be fixed on Python 3.6.') | ||
| def testUnpack(self): | ||
| def reverse(a_b): | ||
| (a, b) = a_b | ||
|
|
@@ -84,13 +99,19 @@ def reverse(a_b): | |
| self.assertReturnType(any_tuple, | ||
| reverse, [trivial_inference.Const((1, 2, 3))]) | ||
|
|
||
| @unittest.skipIf(sys.version_info >= (3, 6, 0) and | ||
| os.environ.get('RUN_SKIPPED_PY3_TESTS') != '1', | ||
| 'This test still needs to be fixed on Python 3.6.') | ||
| def testNoneReturn(self): | ||
| def func(a): | ||
| if a == 5: | ||
| return a | ||
| return None | ||
| self.assertReturnType(typehints.Union[int, type(None)], func, [int]) | ||
|
|
||
| @unittest.skipIf(sys.version_info >= (3, 6, 0) and | ||
| os.environ.get('RUN_SKIPPED_PY3_TESTS') != '1', | ||
| 'This test still needs to be fixed on Python 3.6.') | ||
| def testSimpleList(self): | ||
| self.assertReturnType( | ||
| typehints.List[int], | ||
|
|
@@ -102,6 +123,9 @@ def testSimpleList(self): | |
| lambda xs: list(xs), # List is a disallowed builtin | ||
| [typehints.Tuple[int, ...]]) | ||
|
|
||
| @unittest.skipIf(sys.version_info >= (3, 6, 0) and | ||
| os.environ.get('RUN_SKIPPED_PY3_TESTS') != '1', | ||
| 'This test still needs to be fixed on Python 3.6.') | ||
| def testListComprehension(self): | ||
| self.assertReturnType( | ||
| typehints.List[int], | ||
|
|
@@ -130,6 +154,9 @@ def testTupleListComprehension(self): | |
| lambda L: [(a, a or b, b) for a, b in L], | ||
| [typehints.Iterable[typehints.Tuple[str, int]]]) | ||
|
|
||
| @unittest.skipIf(sys.version_info >= (3, 6, 0) and | ||
| os.environ.get('RUN_SKIPPED_PY3_TESTS') != '1', | ||
| 'This test still needs to be fixed on Python 3.6.') | ||
| def testGenerator(self): | ||
|
|
||
| def foo(x, y): | ||
|
|
@@ -140,12 +167,18 @@ def foo(x, y): | |
| self.assertReturnType( | ||
| typehints.Iterable[typehints.Union[int, float]], foo, [int, float]) | ||
|
|
||
| @unittest.skipIf(sys.version_info >= (3, 6, 0) and | ||
| os.environ.get('RUN_SKIPPED_PY3_TESTS') != '1', | ||
| 'This test still needs to be fixed on Python 3.6.') | ||
| def testGeneratorComprehension(self): | ||
| self.assertReturnType( | ||
| typehints.Iterable[int], | ||
| lambda xs: (x for x in xs), | ||
| [typehints.Tuple[int, ...]]) | ||
|
|
||
| @unittest.skipIf(sys.version_info >= (3, 6, 0) and | ||
| os.environ.get('RUN_SKIPPED_PY3_TESTS') != '1', | ||
| 'This test still needs to be fixed on Python 3.6.') | ||
| def testBinOp(self): | ||
| self.assertReturnType(int, lambda a, b: a + b, [int, int]) | ||
| self.assertReturnType( | ||
|
|
@@ -154,6 +187,9 @@ def testBinOp(self): | |
| typehints.List[typehints.Union[int, str]], lambda a, b: a + b, | ||
| [typehints.List[int], typehints.List[str]]) | ||
|
|
||
| @unittest.skipIf(sys.version_info >= (3, 6, 0) and | ||
| os.environ.get('RUN_SKIPPED_PY3_TESTS') != '1', | ||
| 'This test still needs to be fixed on Python 3.6.') | ||
| def testCall(self): | ||
| f = lambda x, *args: x | ||
| self.assertReturnType( | ||
|
|
@@ -162,22 +198,37 @@ def testCall(self): | |
| self.assertReturnType( | ||
| typehints.Tuple[int, typehints.Any], lambda: (1, f(x=1.0))) | ||
|
|
||
| @unittest.skipIf(sys.version_info >= (3, 6, 0) and | ||
| os.environ.get('RUN_SKIPPED_PY3_TESTS') != '1', | ||
| 'This test still needs to be fixed on Python 3.6.') | ||
| def testClosure(self): | ||
| x = 1 | ||
| y = 1.0 | ||
| self.assertReturnType(typehints.Tuple[int, float], lambda: (x, y)) | ||
|
|
||
| @unittest.skipIf(sys.version_info >= (3, 6, 0) and | ||
| os.environ.get('RUN_SKIPPED_PY3_TESTS') != '1', | ||
| 'This test still needs to be fixed on Python 3.6.') | ||
| def testGlobals(self): | ||
| self.assertReturnType(int, lambda: global_int) | ||
|
|
||
| @unittest.skipIf(sys.version_info >= (3, 6, 0) and | ||
| os.environ.get('RUN_SKIPPED_PY3_TESTS') != '1', | ||
| 'This test still needs to be fixed on Python 3.6.') | ||
| def testBuiltins(self): | ||
| self.assertReturnType(int, lambda x: len(x), [typehints.Any]) | ||
|
|
||
| @unittest.skipIf(sys.version_info >= (3, 6, 0) and | ||
| os.environ.get('RUN_SKIPPED_PY3_TESTS') != '1', | ||
| 'This test still needs to be fixed on Python 3.6.') | ||
| def testGetAttr(self): | ||
| self.assertReturnType( | ||
| typehints.Tuple[str, typehints.Any], | ||
| lambda: (typehints.__doc__, typehints.fake)) | ||
|
|
||
| @unittest.skipIf(sys.version_info >= (3, 6, 0) and | ||
| os.environ.get('RUN_SKIPPED_PY3_TESTS') != '1', | ||
| 'This test still needs to be fixed on Python 3.6.') | ||
| def testMethod(self): | ||
|
|
||
| class A(object): | ||
|
|
@@ -187,6 +238,9 @@ def m(self, x): | |
| self.assertReturnType(int, lambda: A().m(3)) | ||
| self.assertReturnType(float, lambda: A.m(A(), 3.0)) | ||
|
|
||
| @unittest.skipIf(sys.version_info >= (3, 6, 0) and | ||
| os.environ.get('RUN_SKIPPED_PY3_TESTS') != '1', | ||
| 'This test still needs to be fixed on Python 3.6.') | ||
| def testAlwaysReturnsEarly(self): | ||
|
|
||
| def some_fn(v): | ||
|
|
@@ -196,6 +250,9 @@ def some_fn(v): | |
|
|
||
| self.assertReturnType(int, some_fn) | ||
|
|
||
| @unittest.skipIf(sys.version_info >= (3, 6, 0) and | ||
| os.environ.get('RUN_SKIPPED_PY3_TESTS') != '1', | ||
| 'This test still needs to be fixed on Python 3.6.') | ||
| def testDict(self): | ||
| self.assertReturnType( | ||
| typehints.Dict[typehints.Any, typehints.Any], lambda: {}) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have Jira's for this and other failures? Could we reference it here?
Thanks.