aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2024-05-28 23:50:32 -0400
committerEugeniy E. Mikhailov <evgmik@gmail.com>2024-05-28 23:50:32 -0400
commit593e395eb7d17873ddddd5c57bce35d7d0c30e1d (patch)
tree254e14da610f2300572445db1ef4400ddf0ce9e4 /tests
parenta68804ebc415b1642fbbeaf10702880da4ab3c88 (diff)
downloadqolab-593e395eb7d17873ddddd5c57bce35d7d0c30e1d.tar.gz
qolab-593e395eb7d17873ddddd5c57bce35d7d0c30e1d.zip
template for reflow/postprocessing table function
Diffstat (limited to 'tests')
-rw-r--r--tests/tableflow_test_data/tableOut1pariallyProcessed.csv6
-rw-r--r--tests/test_tableflow.py14
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/tableflow_test_data/tableOut1pariallyProcessed.csv b/tests/tableflow_test_data/tableOut1pariallyProcessed.csv
new file mode 100644
index 0000000..250a55e
--- /dev/null
+++ b/tests/tableflow_test_data/tableOut1pariallyProcessed.csv
@@ -0,0 +1,6 @@
+# this is comment line1
+# this is comment line2
+# make sure that the very first column has numbers in it
+x,y,z,out1,out2
+2,3,4,4,9
+
diff --git a/tests/test_tableflow.py b/tests/test_tableflow.py
index 9d6bb3e..0ab8e76 100644
--- a/tests/test_tableflow.py
+++ b/tests/test_tableflow.py
@@ -59,3 +59,17 @@ def test_for_nonexisting_row_and_its_insertion():
assert tblfl.ilocRowOrAdd(tbl1, r) == 3
assert len(tbl1) == 4
+def test_isRedoNeeded():
+ r = pd.Series({'a':2, 'b':4, 'c':pd.NA})
+ assert not tblfl.isRedoNeeded(r, ['a','b'])
+ assert tblfl.isRedoNeeded(r, ['c'])
+ assert tblfl.isRedoNeeded(r, ['non_existing'])
+ assert not tblfl.isRedoNeeded(r, ['b', 'c'])
+
+def test_reflowTable():
+ tIn,tOut = tblfl.loadInOutTables(inputFileName='tests/tableflow_test_data/tableIn1.csv', outputFileName='tests/tableflow_test_data/tableOut1pariallyProcessed.csv', comment='#')
+ tOutRef = tOut.copy()
+ with pytest.warns(UserWarning):
+ tblfl.reflowTable(tIn,tOut)
+
+