<commit_before>from __future__ import print_function
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils

def test1():
    df = h2o.upload_file(pyunit_utils.locate("smalldata/jira/pubdev_2020.csv"))
    splits = df.split_frame(ratios=[0.75])
    assert df.nrow == splits[0].nrow + splits[1].nrow

    part0 = splits[0]
    split_was_sequential = True
    i = 0
    while i < part0.nrow:
        value = part0[i, "C1"]
        print(value)
        if value != (i + 1):
            split_was_sequential = False
        i += 1

    assert False == split_was_sequential

    part1 = splits[1]

    assert part0.nrow > 0
    assert part1.nrow > 1


def test2():
    df = h2o.upload_file(pyunit_utils.locate("smalldata/jira/pubdev_2020.csv"))
    splits = df.split_frame(ratios=[0.5, 0.25])
    assert df.nrow == splits[0].nrow + splits[1].nrow + splits[2].nrow
    assert splits[0].nrow > 0
    assert splits[1].nrow > 0
    assert splits[2].nrow > 0


def test3():
    df = h2o.upload_file(pyunit_utils.locate("smalldata/jira/pubdev_2020.csv"))
    splits = df.split_frame(ratios=[0.8], seed=2015)
    part1 = splits[1]
    value = part1[0, "C1"]
    assert value == 4
    value = part1[1, "C2"]
    assert value == 11
    value = part1[2, "C3"]
    assert value == 22

    df = h2o.upload_file(pyunit_utils.locate("smalldata/jira/pubdev_2020.csv"))
    splits = df.split_frame(ratios=[0.8], seed=2016)
    part1 = splits[1]
    value = part1[0, "C1"]
    assert value == 4, value

    df = h2o.upload_file(pyunit_utils.locate("smalldata/jira/pubdev_2020.csv"))
    splits = df.split_frame(ratios=[0.8], seed=2016)
    part1 = splits[1]
    value = part1[0, "C1"]
    assert value == 4, value


def test4():
    df = h2o.upload_file(pyunit_utils.locate("smalldata/jira/pubdev_2020.csv"))
    splits = df.split_frame(ratios=[0.8], destination_frames=["myf0", "myf1"])
    part0 = splits[0]
    assert part0.frame_id == "myf0"
    part1 = splits[1]
    assert part1.frame_id == "myf1"


def pubdev_2020():
    test1()
    test2()
    test3()
    test4()

if __name__ == "__main__":
    pyunit_utils.standalone_test(pubdev_2020)
else:
    pubdev_2020()<commit_msg>Fix PyUnit golden results.<commit_after>from __future__ import print_function
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils

def test1():
    df = h2o.upload_file(pyunit_utils.locate("smalldata/jira/pubdev_2020.csv"))
    splits = df.split_frame(ratios=[0.75])
    assert df.nrow == splits[0].nrow + splits[1].nrow

    part0 = splits[0]
    split_was_sequential = True
    i = 0
    while i < part0.nrow:
        value = part0[i, "C1"]
        print(value)
        if value != (i + 1):
            split_was_sequential = False
        i += 1

    assert False == split_was_sequential

    part1 = splits[1]

    assert part0.nrow > 0
    assert part1.nrow > 1


def test2():
    df = h2o.upload_file(pyunit_utils.locate("smalldata/jira/pubdev_2020.csv"))
    splits = df.split_frame(ratios=[0.5, 0.25])
    assert df.nrow == splits[0].nrow + splits[1].nrow + splits[2].nrow
    assert splits[0].nrow > 0
    assert splits[1].nrow > 0
    assert splits[2].nrow > 0


def test3():
    df = h2o.upload_file(pyunit_utils.locate("smalldata/jira/pubdev_2020.csv"))
    splits = df.split_frame(ratios=[0.8], seed=0)
    part1 = splits[1]
    value = part1[0, "C1"]
    assert value == 4
    value = part1[1, "C2"]
    assert value == 11
    value = part1[2, "C3"]
    assert value == 22

    df = h2o.upload_file(pyunit_utils.locate("smalldata/jira/pubdev_2020.csv"))
    splits = df.split_frame(ratios=[0.8], seed=0)
    part1 = splits[1]
    value = part1[0, "C1"]
    assert value == 4, value

    df = h2o.upload_file(pyunit_utils.locate("smalldata/jira/pubdev_2020.csv"))
    splits = df.split_frame(ratios=[0.8], seed=0)
    part1 = splits[1]
    value = part1[0, "C1"]
    assert value == 4, value


def test4():
    df = h2o.upload_file(pyunit_utils.locate("smalldata/jira/pubdev_2020.csv"))
    splits = df.split_frame(ratios=[0.8], destination_frames=["myf0", "myf1"])
    part0 = splits[0]
    assert part0.frame_id == "myf0"
    part1 = splits[1]
    assert part1.frame_id == "myf1"


def pubdev_2020():
    test1()
    test2()
    test3()
    test4()

if __name__ == "__main__":
    pyunit_utils.standalone_test(pubdev_2020)
else:
    pubdev_2020()
{'fraction_non_alphanumeric': 0.148308957952468, 'fraction_numerical': 0.0632998171846435, 'mean_word_length': 3.1098591549295773, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2004746', 'n_tokens_mistral': 1866, 'n_tokens_neox': 1718, 'n_words': 324}