Additional test on make_csv_dataset

Verify the delim and NAvalue are compatible with different inputs.
This commit is contained in:
Albin Joy 2019-01-11 17:40:47 +05:30
parent cdbaf19b7b
commit 6ba0adcb80

View File

@ -449,6 +449,29 @@ class MakeCsvDatasetTest(test_base.DatasetTestBase):
header=True, header=True,
) )
def testMakeCSVDataset_withNAValuesAndFieldDelim(self):
"""Tests that datasets can be created from different delim and na_value.
"""
column_names = ["col%d" % i for i in range(5)]
inputs = [["0 1 2 3 4", "5 6 7 8 9"], ["10 11 12 13 14", "15 16 17 ? 19"]]
expected_output = [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9],
[10, 11, 12, 13, 14], [15, 16, 17, 0, 19]]
label = "col0"
self._test_dataset(
inputs,
expected_output=expected_output,
expected_keys=column_names,
column_names=column_names,
label_name=label,
batch_size=1,
num_epochs=1,
shuffle=False,
header=False,
na_value="?",
field_delim=" ",
)
def testMakeCSVDataset_withSelectCols(self): def testMakeCSVDataset_withSelectCols(self):
record_defaults = [ record_defaults = [
constant_op.constant([], dtypes.int32), constant_op.constant([], dtypes.int32),