Example #1
0
 def test_is_ndk_for_file_with_infeasible_latitude(self):
     """
     Tests the is_ndk function a file with an infeasible latitude.
     """
     self.assertFalse(
         is_ndk(
             os.path.join(self.datapath, "faulty_infeasible_latitude.ndk")))
Example #2
0
    def test_is_ndk(self):
        """
        Test for the the is_ndk() function.
        """
        valid_files = [os.path.join(self.datapath, "C200604092050A.ndk"),
                       os.path.join(self.datapath, "multiple_events.ndk")]
        invalid_files = []
        for filename in os.listdir(self.path):
            if filename.endswith(".py"):
                invalid_files.append(os.path.join(self.path, filename))
        self.assertTrue(len(invalid_files) > 0)

        for filename in valid_files:
            self.assertTrue(is_ndk(filename))
        for filename in invalid_files:
            self.assertFalse(is_ndk(filename))
Example #3
0
    def test_is_ndk(self):
        """
        Test for the the is_ndk() function.
        """
        valid_files = [
            os.path.join(self.datapath, "C200604092050A.ndk"),
            os.path.join(self.datapath, "multiple_events.ndk")
        ]
        invalid_files = []
        for filename in os.listdir(self.path):
            if filename.endswith(".py"):
                invalid_files.append(os.path.join(self.path, filename))
        self.assertTrue(len(invalid_files) > 0)

        for filename in valid_files:
            self.assertTrue(is_ndk(filename))
        for filename in invalid_files:
            self.assertFalse(is_ndk(filename))
Example #4
0
    def test_reading_from_bytestring(self):
        """
        Tests reading from a byte string.
        """
        filename = os.path.join(self.datapath, "C200604092050A.ndk")

        reference = os.path.join(self.datapath, "C200604092050A.xml")
        ref_cat = readEvents(reference)

        with io.open(filename, "rb") as fh:
            data = fh.read()

        self.assertTrue(is_ndk(data))
        cat = read_ndk(data)

        self.assertEqual(cat, ref_cat)
Example #5
0
    def test_reading_from_bytestring(self):
        """
        Tests reading from a byte string.
        """
        filename = os.path.join(self.datapath, "C200604092050A.ndk")

        reference = os.path.join(self.datapath, "C200604092050A.xml")
        ref_cat = readEvents(reference)

        with io.open(filename, "rb") as fh:
            data = fh.read()

        self.assertTrue(is_ndk(data))
        cat = read_ndk(data)

        self.assertEqual(cat, ref_cat)
Example #6
0
 def test_is_ndk_for_file_with_infeasible_latitude(self):
     """
     Tests the is_ndk function a file with an infeasible latitude.
     """
     self.assertFalse(is_ndk(os.path.join(self.datapath, "faulty_infeasible_latitude.ndk")))
Example #7
0
 def test_is_ndk_for_file_with_invalid_date(self):
     """
     Tests the is_ndk function for a file with invalid date.
     """
     self.assertFalse(is_ndk(os.path.join(self.datapath, "faulty_invalid_date.ndk")))
Example #8
0
 def test_is_ndk_for_file_with_invalid_date(self):
     """
     Tests the is_ndk function for a file with invalid date.
     """
     self.assertFalse(
         is_ndk(os.path.join(self.datapath, "faulty_invalid_date.ndk")))