aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qolab/tableflow/__init__.py2
-rw-r--r--tests/test_tableflow.py9
2 files changed, 10 insertions, 1 deletions
diff --git a/qolab/tableflow/__init__.py b/qolab/tableflow/__init__.py
index ea380c3..2a150a8 100644
--- a/qolab/tableflow/__init__.py
+++ b/qolab/tableflow/__init__.py
@@ -26,7 +26,7 @@ def loadInOutTables(inputFileName=None, outputFileName=None, comment=None):
tIn.columns = tIn.columns.str.removeprefix(' '); # clean up leading white space in columns names
try:
- tOut=pd.read_csv(results_file)
+ tOut=pd.read_csv(outputFileName, comment=comment)
except Exception:
tOut=tIn.copy(deep=True)
diff --git a/tests/test_tableflow.py b/tests/test_tableflow.py
index 0ab8e76..fce3449 100644
--- a/tests/test_tableflow.py
+++ b/tests/test_tableflow.py
@@ -26,11 +26,20 @@ def test_table_equality_with_no_output_file_name():
assert not tIn.equals(tOut)
def test_table_load_with_in_out_file_names():
+ # different filenames, same content for ease of testing
tIn,tOut = tblfl.loadInOutTables(inputFileName='tests/tableflow_test_data/tableIn1.csv', outputFileName='tests/tableflow_test_data/tableOut1nonProcessed.csv', comment='#')
assert type(tIn) == pd.core.frame.DataFrame
assert type(tOut) == pd.core.frame.DataFrame
assert tIn.equals(tOut)
+ # different filenames, different content
+ tIn,tOut = tblfl.loadInOutTables(inputFileName='tests/tableflow_test_data/tableIn1.csv', outputFileName='tests/tableflow_test_data/tableOut1pariallyProcessed.csv', comment='#')
+ assert type(tIn) == pd.core.frame.DataFrame
+ assert type(tOut) == pd.core.frame.DataFrame
+ assert not tIn.equals(tOut)
+ assert 'out1' in tOut.columns
+ assert 'out1' not in tIn.columns
+
def test_for_existing_row():
tbl1 = pd.DataFrame( {'a':[1,2,3], 'b':[1,4,6]})
r = pd.Series({'a':2, 'b':4})