示例#1
0
 def has_blkt_100(filename):
     ms = _MSStruct(filename)
     ms.read(-1, 0, 1, 0)
     blkt_link = ms.msr.contents.blkts
     has_blkt_100 = False
     while True:
         try:
             if blkt_link.contents.blkt_type == 100:
                 has_blkt_100 = True
                 break
             blkt_link = blkt_link.contents.next
         except ValueError:
             break
     del ms
     return has_blkt_100
示例#2
0
 def has_blkt_100(filename):
     ms = _MSStruct(filename)
     ms.read(-1, 0, 1, 0)
     blkt_link = ms.msr.contents.blkts
     has_blkt_100 = False
     while True:
         try:
             if blkt_link.contents.blkt_type == 100:
                 has_blkt_100 = True
                 break
             blkt_link = blkt_link.contents.next
         except ValueError:
             break
     del ms
     return has_blkt_100
示例#3
0
    def test_issue312(self):
        """
        Tests issue #312

        The blkt_link struct was defined wrong.
        """
        filename = os.path.join(self.path, "data", "BW.BGLD.__.EHE.D.2008.001.first_10_records")
        # start and end time
        ms = _MSStruct(filename)
        ms.read(-1, 0, 1, 0)
        blkt_link = ms.msr.contents.blkts.contents
        # The first blockette usually begins after 48 bytes. In the test file
        # it does.
        self.assertEqual(blkt_link.blktoffset, 48)
        # The first blockette is blockette 1000 in this file.
        self.assertEqual(blkt_link.blkt_type, 1000)
        # Only one blockette.
        self.assertEqual(blkt_link.next_blkt, 0)
        # Blockette data is 8 bytes - 4 bytes for the blockette header.
        self.assertEqual(blkt_link.blktdatalen, 4)
        del ms
示例#4
0
    def test_issue312(self):
        """
        Tests issue #312

        The blkt_link struct was defined wrong.
        """
        filename = os.path.join(self.path, 'data',
                                'BW.BGLD.__.EHE.D.2008.001.first_10_records')
        # start and end time
        ms = _MSStruct(filename)
        ms.read(-1, 0, 1, 0)
        blkt_link = ms.msr.contents.blkts.contents
        # The first blockette usually begins after 48 bytes. In the test file
        # it does.
        self.assertEqual(blkt_link.blktoffset, 48)
        # The first blockette is blockette 1000 in this file.
        self.assertEqual(blkt_link.blkt_type, 1000)
        # Only one blockette.
        self.assertEqual(blkt_link.next_blkt, 0)
        # Blockette data is 8 bytes - 4 bytes for the blockette header.
        self.assertEqual(blkt_link.blktdatalen, 4)
        del ms