def testDataDiffSheets(self):
     input_file = os.path.join(TEST_DATA_DIR,
                               "test_excel3_wrong_sheets.xlsx")
     test_input = ["-c", input_file]
     if logger.isEnabledFor(logging.DEBUG):
         my_script.main(test_input)
     with capture_stderr(my_script.main, test_input) as output:
         self.assertTrue("Given excel input should have sheets" in output)
 def test_wilcox_output(self):
     input_file = os.path.join(TEST_DATA_DIR, "test_excel2.xlsx")
     test_input = ["-c", input_file]
     my_script.main(test_input)
     with open('wilcoxon_test_out.txt', 'r') as a:
         analysis_results = a.readlines()
         p_value = (analysis_results[1].split('=')[2])[:-1]
         print(p_value)
         self.assertLess(float(p_value), 1)
 def testSampleData2(self):
     # A second check, with slightly different values, of the data_analysis function
     input_file = os.path.join(TEST_DATA_DIR, "test_excel2.xlsx")
     test_input = ["-c", input_file]
     my_script.main(test_input)
     with open(TEST_DATA_DIR + '\wilcoxon_test_out2.txt', 'r') as e:
         expected_results = e.readlines()
         with open('wilcoxon_test_out.txt', 'r') as a:
             analysis_results = a.readlines()
             self.assertEqual(expected_results, analysis_results)
    def testSampleData(self):
        # Tests that the np array generated by the data_analysis function matches saved expected results

        input_file = os.path.join(TEST_DATA_DIR, "test_excel1.xlsx")
        test_input = ["-c", input_file]
        my_script.main(test_input)
        with open(TEST_DATA_DIR + '\wilcoxon_test_out1.txt', 'r') as e:
            expected_results = e.readlines()
            with open('wilcoxon_test_out.txt', 'r') as a:
                analysis_results = a.readlines()
                self.assertEqual(expected_results, analysis_results)
    def testSampleData(self):
        # Checks that runs with defaults and that files are created
        test_input = ["-c", SAMPLE_DATA_FILE_LOC]
        try:
            if logger.isEnabledFor(logging.DEBUG):
                my_script.main(test_input)
            # checks that the expected message is sent to standard out
            with capture_stdout(my_script.main, test_input) as output:
                self.assertTrue("co-relation_data.xlsx" in output)

            self.assertTrue(os.path.isfile("wilcoxon_test_out.txt"))
            self.assertTrue(os.path.isfile("co_relations.png"))
        finally:
            silent_remove(DEF_XLSX_OUT, disable=DISABLE_REMOVE)
            silent_remove(DEF_PNG_OUT, disable=DISABLE_REMOVE)
 def testMissingFile(self):
     test_input = ["-c", "random_file.xlsx"]
     if logger.isEnabledFor(logging.DEBUG):
         my_script.main(test_input)
     with capture_stderr(my_script.main, test_input) as output:
         self.assertTrue("random_file.xlsx" in output)