forked from apache/incubator-wayang
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WAYANG-#8] Add Integration test of Python-Platform
Signed-off-by: bertty <[email protected]>
- Loading branch information
Showing
4 changed files
with
16,931 additions
and
30 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -1,16 +1,42 @@ | ||
import unittest | ||
import tempfile | ||
from os import fdopen | ||
from typing import List | ||
|
||
from pywy.config import RC_TEST_DIR as ROOT | ||
from pywy.dataquanta import WayangContext | ||
from pywy.plugins import PYTHON | ||
|
||
|
||
class TestIntegrationPythonPlatform(unittest.TestCase): | ||
|
||
file_10e0: str | ||
|
||
def setUp(self): | ||
self.file_10e0 = "{}/10e0MB.input".format(ROOT) | ||
pass | ||
|
||
def test_TO_REMOVE(self): | ||
""" | ||
TODO REMOVE THIS TEST, IT JUST TO VALIDATE THAT EVERYTHING IS CORRECT IN TERMS OF ENVIRONMENT | ||
Returns | ||
------- | ||
def test_grep(self): | ||
def pre(a: str) -> bool: | ||
return 'six' in a | ||
|
||
fd, path_tmp = tempfile.mkstemp() | ||
|
||
WayangContext() \ | ||
.register(PYTHON) \ | ||
.textfile(self.file_10e0) \ | ||
.filter(pre) \ | ||
.store_textfile(path_tmp) | ||
|
||
lines_filter: List[str] | ||
with open(self.file_10e0, 'r') as f: | ||
lines_filter = list(filter(pre, f.readlines())) | ||
selectivity = len(list(lines_filter)) | ||
|
||
""" | ||
self.assertEqual("a", "a") | ||
lines_platform: List[str] | ||
with fdopen(path_tmp, 'r') as fp: | ||
lines_platform = fp.readlines() | ||
elements = len(lines_platform) | ||
|
||
self.assertEqual(selectivity, elements) | ||
self.assertEqual(lines_filter, lines_platform) |
Oops, something went wrong.