Ejemplo n.º 1
0
    def test_file_test_not_file(self):
        """ Test the general file testing routine with a bad filename
        """
        self.assertFalse(ocb_igen.test_file("/"))

        self.assertEqual(len(self.log_handler.formatted_records), 1)
        self.assertTrue(self.log_handler.formatted_records[0].find( \
                                            'name provided is not a file') > 0)
Ejemplo n.º 2
0
    def test_file_test_empty_file(self):
        """ Test the general file testing routine with a bad filename
        """
        # Create an empty file
        open(self.temp_output, 'a').close()

        self.assertFalse(ocb_igen.test_file(self.temp_output))

        self.assertEqual(len(self.log_handler.formatted_records), 1)
        self.assertTrue(
            self.log_handler.formatted_records[0].find('empty file') > 0)
Ejemplo n.º 3
0
    def test_supermag2ascii_ocb_bad_ocb(self):
        """ Test the conversion of SuperMAG data from AACGM coordinates into
        OCB coordinates
        """
        from ocbpy.instruments.general import test_file

        ocb_ismag.supermag2ascii_ocb(self.test_file,
                                     "fake_out",
                                     ocbfile="fake_ocb")

        # Compare created file to stored test file
        self.assertFalse(test_file("fake_out"))
Ejemplo n.º 4
0
    def test_vort2ascii_ocb_no_ocb(self):
        """ Test the conversion of vorticity data from AACGM coordinates into
        OCB coordinates
        """
        from ocbpy.instruments.general import test_file

        ocb_ivort.vort2ascii_ocb(self.test_file,
                                 "fake_out",
                                 ocbfile="fake_ocb")

        # Compare created file to stored test file
        self.assertFalse(test_file("fake_out"))
Ejemplo n.º 5
0
    def test_supermag2ascii_ocb_bad_input(self):
        """ Test the conversion of SuperMAG data from AACGM coordinates into
        OCB coordinates
        """
        from ocbpy.instruments.general import test_file

        try:
            ocb_ismag.supermag2ascii_ocb("fake_file",
                                         "fake_out",
                                         ocbfile=self.test_ocb)

            # Compare created file to stored test file
            self.assertFalse(test_file("fake_out"))
        except AssertionError:
            self.assertTrue(True)
Ejemplo n.º 6
0
    def test_vort2ascii_ocb_load_failure(self):
        """ Test the conversion of vorticity data from AACGM coordinates into
        OCB coordinates with a bad vorticity file
        """
        from ocbpy.instruments.general import test_file

        try:
            ocb_ivort.vort2ascii_ocb("fake_file",
                                     "fake_out",
                                     ocbfile=self.test_ocb)

            # Compare created file to stored test file
            self.assertFalse(test_file("fake_out"))
        except AssertionError:
            self.assertTrue(True)
Ejemplo n.º 7
0
 def test_file_test_true(self):
     """ Test the general file testing routine with a good file
     """
     self.assertTrue(ocb_igen.test_file(self.test_file))