diff --git a/mtbp3/stdiso/pdfsummary.py b/mtbp3/stdiso/pdfsummary.py index 2dd2f38..21b8246 100644 --- a/mtbp3/stdiso/pdfsummary.py +++ b/mtbp3/stdiso/pdfsummary.py @@ -16,7 +16,7 @@ from pypdf import PdfReader import os import pandas as pd -from mtbp3 import cdt, util +from mtbp3 import util class pdfSummary: """ @@ -186,7 +186,7 @@ def show_outline_tree(self, max_itr=5, to_right=False): if len(self.outline_list) != 2: raise ValueError("self.outline_list should be a length 2 list") - tree = cdt.ListTree(lst=self.outline_list[0], infmt='dotspace') + tree = util.cdt.ListTree(lst=self.outline_list[0], infmt='dotspace') return '\n'.join(tree.list_tree(to_right=to_right)) if __name__ == "__main__": diff --git a/mtbp3/util/util.py b/mtbp3/util/util.py deleted file mode 100644 index 5f2645a..0000000 --- a/mtbp3/util/util.py +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (C) 2023-2024 Y Hsu -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public license as published by -# the Free software Foundation, either version 3 of the License, or -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details -# -# You should have received a copy of the GNU General Public license -# along with this program. If not, see - -import os - -_ROOT = os.path.abspath(os.path.dirname(__file__)) -def get_data(path): - return os.path.join(_ROOT, '../data', path) - -if __name__ == "__main__": - pass \ No newline at end of file diff --git a/tests/test_cdt.py b/tests/test_util_cdt.py similarity index 100% rename from tests/test_cdt.py rename to tests/test_util_cdt.py diff --git a/tests/test_util_cdtg.py b/tests/test_util_cdtg.py new file mode 100644 index 0000000..eb2d432 --- /dev/null +++ b/tests/test_util_cdtg.py @@ -0,0 +1,33 @@ +import unittest +import warnings +from mtbp3.util.cdtg import catPlotter +import pandas as pd + +class TestCatPlotter(unittest.TestCase): + + def setUp(self): + self.df = pd.DataFrame({ + 'Group': ['A', 'A', 'B', 'B', 'C', 'C'], + 'Value': [1, 2, 3, 4, 5, 6], + 'Grid': ['G1', 'G1', 'G2', 'G2', 'G1', 'G1'], + 'CValue': ['C1', 'C2', 'C1', 'C2', 'C1', 'C2'], + 'CValueGroup': [1, 1, 2, 2, 1, 1] + }) + + def test_boxplot(self): + warnings.filterwarnings("ignore") + plotter = catPlotter(self.df, y_col='Value', group_col='Group', x_col='CValue', grid_col='Grid') + plotter.boxplot() + + def test_lineplot(self): + plotter = catPlotter(self.df, y_col='Value', group_col='Group', x_col='CValue', grid_col='Grid') + plotter.lineplot() + + def test_update_parameters(self): + plotter = catPlotter(self.df, y_col='Value', group_col='Group', x_col='CValue', grid_col='Grid') + plotter.update_parameters(y_col='NewValue', fig_size_0=10) + self.assertEqual(plotter.y_col, 'NewValue') + self.assertEqual(plotter.fig_size_0, 10) + +if __name__ == "__main__": + unittest.main() \ No newline at end of file diff --git a/tests/test_lsr.py b/tests/test_util_lsr.py similarity index 100% rename from tests/test_lsr.py rename to tests/test_util_lsr.py