def testArrayWrongDelimiter(self):
     test_input = ["-f", VEC_INPUT]
     main(test_input)
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("delimiter" in output)
 def testIncDimen(self):
     # Test what happens when the lines do not all have the same number of dimensions
     test_input = ["-f", BAD_INPUT2, "-d", ' ']
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("Problems reading data" in output)
         self.assertTrue("3 values " in output)
         self.assertTrue("2 values" in output)
 def testDefInp(self):
     test_input = ["-f", DEF_INPUT, "-d", ' ']
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     try:
         with capture_stdout(main, test_input) as output:
             self.assertTrue(GOOD_OUT in output)
             self.assertFalse(diff_lines(CSV_OUT, GOOD_CSV_OUT))
     finally:
         silent_remove(CSV_OUT, disable=DISABLE_REMOVE)
 def testCsv(self):
     """
     This input file has a header that starts with a '#' so is ignored by np.loadtxt
     """
     test_input = ["-f", CSV_INPUT, "-d", ","]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     try:
         with capture_stdout(main, test_input) as output:
             self.assertTrue(GOOD_OUT in output)
             self.assertFalse(diff_lines(CSV_OUT, GOOD_CSV_OUT))
     finally:
         silent_remove(CSV_OUT, disable=DISABLE_REMOVE)
 def testDefInpWithBuffer(self):
     try:
         test_input = ["-f", DEF_INPUT, "-b", "6", "-d", ' ']
         if logger.isEnabledFor(logging.DEBUG):
             main(test_input)
         with capture_stdout(main, test_input) as output:
             self.assertTrue(
                 'Max plus 6.0 buffer:'
                 '        17.891000        21.605000        24.314000' in
                 output)
             self.assertFalse(diff_lines(CSV_OUT, GOOD_CSV_BUFFER_OUT))
     finally:
         silent_remove(CSV_OUT, disable=DISABLE_REMOVE)
 def testBadInput(self):
     # Test what happens when cannot convert a value to float
     #   Note: within Intellij, some values were not nan that were nan outside the environment
     #   thus, I'm not checking the output for exactly no line differences
     try:
         test_input = ["-f", BAD_INPUT, '-d', ' ']
         if logger.isEnabledFor(logging.DEBUG):
             main(test_input)
         with capture_stderr(main, test_input) as output:
             self.assertTrue("could not be converted to a float" in output)
             self.assertLess(
                 len(diff_lines(BAD_INPUT_OUT, GOOD_BAD_INPUT_OUT)), 7)
     finally:
         silent_remove(BAD_INPUT_OUT, disable=DISABLE_REMOVE)
 def testHist(self):
     try:
         main(["-f", HIST_INPUT, "-n", "-d", ",", "-s"])
         for p_file in [HIST_PNG1, HIST_PNG2, HIST_PNG3]:
             self.assertGreater(os.path.getsize(p_file), 10000)
         self.assertFalse(diff_lines(HIST_OUT, GOOD_HIST_OUT))
         self.assertFalse(diff_lines(HIST_COUNT, GOOD_HIST_COUNT))
     finally:
         [
             silent_remove(o_file, disable=DISABLE_REMOVE) for o_file in [
                 HIST_PNG1,
                 HIST_PNG2,
                 HIST_PNG3,
                 HIST_OUT,
                 HIST_COUNT,
             ]
         ]
 def testMinMax(self):
     try:
         main(["-f", MIN_MAX_INPUT, "-n", "-d", ",", "-m", MIN_MAX_FILE])
         self.assertFalse(diff_lines(MIN_MAX_OUT, GOOD_MIN_MAX_OUT))
     finally:
         silent_remove(MIN_MAX_OUT, disable=DISABLE_REMOVE)
 def testVectorNotArray(self):
     test_input = ["-f", VEC_INPUT, "-d", ' ']
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("File contains a vector" in output)