-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/rel-3.42.0'
- Loading branch information
Showing
6 changed files
with
77 additions
and
4 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
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
33 changes: 33 additions & 0 deletions
33
h2o-py/tests/testdir_parser/pyunit_parse_single_entry_arff.py
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import os | ||
import sys | ||
import tempfile | ||
|
||
sys.path.insert(1, "../../") | ||
import h2o | ||
from tests import pyunit_utils | ||
|
||
|
||
def test_single_entry_arff_file(): | ||
with open(pyunit_utils.locate("smalldata/junit/arff/iris.arff"), "r") as input_: | ||
arff = input_.readlines() | ||
data_start = arff.index("@DATA\n") | ||
subsample = arff[:data_start + 2] | ||
print(subsample[-3:]) | ||
_fd, tmp = tempfile.mkstemp(".arff") | ||
try: | ||
with open(tmp, "w") as output: | ||
output.write(''.join(subsample)) | ||
|
||
train = h2o.import_file(pyunit_utils.locate("smalldata/junit/arff/iris.arff")) | ||
test = h2o.import_file(tmp) | ||
|
||
print(f"{train.columns} == {test.columns}: {train.columns == test.columns}") | ||
assert train.columns == test.columns | ||
finally: | ||
os.unlink(tmp) | ||
|
||
|
||
if __name__ == "__main__": | ||
pyunit_utils.standalone_test(test_single_entry_arff_file) | ||
else: | ||
test_single_entry_arff_file() |