From 875e650865586b795af73373af288148ec231c49 Mon Sep 17 00:00:00 2001 From: TinWoodman92 Date: Wed, 5 Jul 2023 21:25:34 -0500 Subject: Moved tests into package. --- tests/test_import_variable.py | 49 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tests/test_import_variable.py (limited to 'tests/test_import_variable.py') diff --git a/tests/test_import_variable.py b/tests/test_import_variable.py new file mode 100644 index 0000000..c8ac5ed --- /dev/null +++ b/tests/test_import_variable.py @@ -0,0 +1,49 @@ +import unittest +import dialoguer + + +class TestImportVariable(unittest.TestCase): + + # @classmethod + # def setUpClass(cls): + # source_file_path = __file__.replace('.py', '.r') + # cls.src_fil_r = dialoguer.Dialogue(source_file_path) + + # @classmethod + # def tearDownClass(cls): + # cls.src_fil_r.close() + + def setUp(self): + source_file_path = __file__.replace('.py', '.r') + self.src_fil_r = dialoguer.Dialogue(source_file_path) + + def tearDown(self): + self.src_fil_r.close() + + def test_import_string(self): + msg_1 = self.src_fil_r.import_variable('msg_1') + msg_2 = self.src_fil_r.import_variable('msg_2') + self.assertEqual(msg_1, 'Initializing Client - R') + self.assertEqual(msg_2, 'Initialized Client - R') + + def test_import_integer(self): + int_1 = self.src_fil_r.import_variable('int_1') + int_2 = self.src_fil_r.import_variable('int_2') + self.assertEqual(int_1, 3) + self.assertEqual(int_2, 155) + + def test_import_boolean(self): + chk_1 = self.src_fil_r.import_variable('chk_1') + chk_2 = self.src_fil_r.import_variable('chk_2') + self.assertEqual(chk_1, True) + self.assertEqual(chk_2, False) + + def test_import_double(self): + dbl_1 = self.src_fil_r.import_variable('dbl_1') + dbl_2 = self.src_fil_r.import_variable('dbl_2') + self.assertEqual(dbl_1, 3) + self.assertEqual(dbl_2, 12.345) + + +if __name__ == '__main__': + unittest.main() -- cgit v1.2.3