def test_parse(self): bytes = [ 0b10000001, # subband bitmap 0, # scan automation period ] sp = SubProfile.parse(ConstBitStream(bytes=bytes)) self.assertEqual(sp.subband_bitmap, 0b10000001) self.assertEqual(sp.scan_automation_period.mant, CT(0).mant) self.assertEqual(sp.scan_automation_period.exp, CT(0).exp)
def parse(s): channel_header = ChannelHeader.parse(s) sub_profiles = [] for _ in range(AccessProfile.NUMBER_OF_SUB_PROFILES): sub_profiles.append(SubProfile.parse(s)) sub_bands = [] for _ in range(AccessProfile.MAX_NUMBER_OF_SUB_BANDS): sub_bands.append(SubBand.parse(s)) return AccessProfile(channel_header=channel_header, sub_bands=sub_bands, sub_profiles=sub_profiles)