Ejemplo n.º 1
0
    def test_long_stream(self):
        """
        Read test data and pull out data particles.
        Assert the expected number of particles is captured and there are no exceptions
        """

        fid = open(os.path.join(RESOURCE_PATH, 'subset.csv'), 'rU')

        stream_handle = fid
        parser = AdcpaNAuvParser(stream_handle, self.exception_callback)

        particles = parser.get_records(4130)

        self.assertEqual(len(particles), 4130)

        self.assertEqual(self.exception_callback_value, [])

        fid.close()
Ejemplo n.º 2
0
    def test_bad_param(self):
        """
        Read test data and pull out data particles.
        Assert the expected we get an error due to incorrect parameter format
        """

        fid = open(os.path.join(RESOURCE_PATH, 'subset_bad_param.csv'), 'rU')

        stream_handle = fid
        parser = AdcpaNAuvParser(stream_handle,
                                 self.exception_callback)

        particles = parser.get_records(4)  # ask for 4 should get 3

        self.assert_particles(particles, 'adcpa_n_auv_bad_param.yml', RESOURCE_PATH)

        self.assertIsInstance(self.exception_callback_value[0], SampleEncodingException)

        fid.close()
Ejemplo n.º 3
0
    def test_long_stream(self):
        """
        Read test data and pull out data particles.
        Assert the expected number of particles is captured and there are no exceptions
        """

        fid = open(os.path.join(RESOURCE_PATH, 'subset.csv'), 'rU')

        stream_handle = fid
        parser = AdcpaNAuvParser(stream_handle,
                                 self.exception_callback)

        particles = parser.get_records(4130)

        self.assertEqual(len(particles), 4130)

        self.assertEqual(self.exception_callback_value, [])

        fid.close()
Ejemplo n.º 4
0
    def test_simple(self):
        """
        Read test data and pull out data particles.
        Assert that the results are those we expected.
        Expect the first input record to be skipped due to invalid timestamp
        """

        fid = open(os.path.join(RESOURCE_PATH, 'subset_reduced.csv'), 'rU')

        stream_handle = fid
        parser = AdcpaNAuvParser(stream_handle, self.exception_callback)

        particles = parser.get_records(22)

        self.assert_particles(particles, 'adcpa_n_auv_22.yml', RESOURCE_PATH)

        self.assertEqual(self.exception_callback_value, [])

        fid.close()
Ejemplo n.º 5
0
    def test_simple(self):
        """
        Read test data and pull out data particles.
        Assert that the results are those we expected.
        Expect the first input record to be skipped due to invalid timestamp
        """

        fid = open(os.path.join(RESOURCE_PATH, 'subset_reduced.csv'), 'rU')

        stream_handle = fid
        parser = AdcpaNAuvParser(stream_handle,
                                 self.exception_callback)

        particles = parser.get_records(22)

        self.assert_particles(particles, 'adcpa_n_auv_22.yml', RESOURCE_PATH)

        self.assertEqual(self.exception_callback_value, [])

        fid.close()
Ejemplo n.º 6
0
    def _build_parser(self, stream_handle):

        parser = AdcpaNAuvParser(stream_handle, self._exception_callback)

        return parser