-
Notifications
You must be signed in to change notification settings - Fork 47
[FEATURE] Add preliminary support for is keyword #35
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
14 commits
Select commit
Hold shift + click to select a range
cbaebc9
writing tests for is keyword
1bc95da
update test_is.py with failing test
51fbd52
fix typo
0f3dd0b
refactor and change logic, support optional types
4ffd04c
nit
5ee9444
misunderstood domain for is
8b0eff9
passing tests
66845b2
address comments
9437e89
should pass tests now
0638341
nit
d2aab59
add associativity tests, modify is typecheck logic, add file header
fd75db3
nit
69ad71e
fix tracer test bug
dad49ea
remove debug
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 |
|---|---|---|
|
|
@@ -51,6 +51,7 @@ enum class TokenType { | |
| IN, | ||
| NOTIN, | ||
| IS, | ||
| ISNOT, | ||
| LAMBDA, | ||
| NONLOCAL, | ||
| NOT, | ||
|
|
||
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
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 |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import tuplex | ||
| from unittest import TestCase | ||
| """ | ||
| Tests functionality for `is` keyword. | ||
| """ | ||
| class TestIs(TestCase): | ||
|
|
||
| def setUp(self): | ||
| self.conf = {"webui.enable": False, "executorCount": "0"} | ||
| self.c = tuplex.Context(self.conf) | ||
|
|
||
| def test_boolIsBool(self): | ||
| res = self.c.parallelize([False, True, False, False, True]).map(lambda x: x is False).collect() | ||
| self.assertEqual(res, [True, False, True, True, False]) | ||
|
|
||
| def test_boolIsNotBool(self): | ||
| res = self.c.parallelize([True, False, True, False, True]).map(lambda x: x is not False).collect() | ||
| self.assertEqual(res, [True, False, True, False, True]) | ||
|
|
||
| def test_boolIsNone(self): | ||
| res = self.c.parallelize([True, False, False, True]).map(lambda x: x is None).collect() | ||
| self.assertEqual(res, [False] * 4) | ||
|
|
||
| def test_mixedIsNone(self): | ||
| res = self.c.parallelize([None, 255, 400, False, 2.3]).map(lambda x: x is None).collect() | ||
| self.assertEqual(res, [True, False, False, False, False]) | ||
|
|
||
| def test_mixedIsNotNone(self): | ||
| res = self.c.parallelize([None, None, None]).map(lambda x: x is not None).collect() | ||
| self.assertEqual(res, [False, False, False]) | ||
|
|
||
| def test_mixedIsNotNone2(self): | ||
| res = self.c.parallelize([None, True, False]).map(lambda x: x is not None).collect() | ||
| self.assertEqual(res, [False, True, True]) | ||
|
|
||
| def test_mixedIsNotNone3(self): | ||
| res = self.c.parallelize([2, False, None]).map(lambda x: x is not None).collect() | ||
| self.assertEqual(res, [True, True, False]) |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.