Exemplo n.º 1
0
    def test_ldp_splitfilewrapper_mixed(self):
        """Test the LDP interface for a SplitFileWrapper in a contorted way."""

        w = SplitFileWrapper([drxFile, tbfFile], sort=False)
        f = ldp.LWASVDataFile(fh=w)

        # File info
        self.assertTrue(isinstance(f, ldp.DRXFile))

        # Read some
        frames = []
        while True:
            try:
                frame = f.read_frame()
                frames.append(frame)
            except errors.SyncError:
                continue
            except errors.EOFError:
                break
        self.assertEqual(len(frames),
                         32 + 1)  # There is data at the end of the "file" now
Exemplo n.º 2
0
    def test_ldp_splitfilewrapper_discover(self):
        """Test the LDP interface for type discover with a SplitFileWrapper."""

        w = SplitFileWrapper([
            tbnFile,
        ])
        f = ldp.LWASVDataFile(fh=w)

        # File info
        self.assertTrue(isinstance(f, ldp.TBNFile))
        self.assertEqual(f.get_info("sample_rate"), 100e3)
        self.assertEqual(f.get_info("data_bits"), 8)
        self.assertEqual(f.get_info('nframe'), 29)

        self.assertEqual(f.sample_rate, 100e3)
        self.assertEqual(f.data_bits, 8)
        self.assertEqual(f.nframe, 29)

        # Read a frame
        frame = f.read_frame()

        f.close()
        w.close()
Exemplo n.º 3
0
 def test_ldp_discover_cor(self):
     """Test the LDP LWASVDataFile function of COR."""
     # TBF
     f = ldp.LWASVDataFile(corFile)
     self.assertEqual(type(f), ldp.CORFile)
Exemplo n.º 4
0
 def test_ldp_discover_tbf(self):
     """Test the LDP LWASVDataFile function of TBF."""
     # TBF
     f = ldp.LWASVDataFile(tbfFile)
     self.assertEqual(type(f), ldp.TBFFile)
Exemplo n.º 5
0
 def test_ldp_discover_drspec(self):
     """Test the LDP LWASVDataFile function of DR Spectrometer."""
     # DR Spectrometer
     f = ldp.LWASVDataFile(drspecFile)
     self.assertEqual(type(f), ldp.DRSpecFile)
Exemplo n.º 6
0
 def test_ldp_discover_drx(self):
     """Test the LDP LWASVDataFile function of DRX."""
     # DRX
     f = ldp.LWASVDataFile(drxFile)
     self.assertEqual(type(f), ldp.DRXFile)