Skip to content

Commit bdb851e

Browse files
committed
Add TCSTAT tests
1 parent 52614c0 commit bdb851e

1 file changed

Lines changed: 40 additions & 1 deletion

File tree

METdbLoad/test/test_read_data_files.py

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
MTD_DIR,
2424
MTD_EMPTY,
2525
MTD_HEADER_NO_DATA,
26+
TCSTAT_DIR,
27+
TCSTAT_NO_HEADER,
2628
)
2729

2830

@@ -370,4 +372,41 @@ def test_mtd_header_no_data(tmp_path, get_generic_xml_loadfile):
370372
with pytest.raises(SystemExit):
371373
rdf.read_data(
372374
XML_LOADFILE.flags, XML_LOADFILE.load_files, XML_LOADFILE.line_types
373-
)
375+
)
376+
377+
@pytest.mark.parametrize("get_generic_xml_loadfile", ['tcst'], indirect=True)
378+
def test_tcst(tmp_path, get_generic_xml_loadfile):
379+
'''
380+
Verify that expected behavior is observed when the tcst file has data
381+
but no header.
382+
383+
'''
384+
XML_LOADFILE = get_generic_xml_loadfile(tmp_path, TCSTAT_DIR, 'tcst')
385+
386+
# Read all of the data from the data files into a dataframe
387+
rdf = ReadDataFiles()
388+
389+
rdf.read_data(
390+
XML_LOADFILE.flags, XML_LOADFILE.load_files, XML_LOADFILE.line_types
391+
)
392+
393+
# Expect 8 rows of data
394+
assert rdf.stat_data.shape[0] == 8
395+
396+
397+
@pytest.mark.parametrize("get_generic_xml_loadfile", ['tcst'], indirect=True)
398+
def test_tcst_no_header(tmp_path, get_generic_xml_loadfile):
399+
'''
400+
Verify that expected behavior is observed when the tcst file has data
401+
but no header.
402+
403+
'''
404+
XML_LOADFILE = get_generic_xml_loadfile(tmp_path, TCSTAT_NO_HEADER, 'tcst')
405+
406+
# Read all of the data from the data files into a dataframe
407+
rdf = ReadDataFiles()
408+
409+
with pytest.raises(SystemExit):
410+
rdf.read_data(
411+
XML_LOADFILE.flags, XML_LOADFILE.load_files, XML_LOADFILE.line_types
412+
)

0 commit comments

Comments
 (0)