def test_metadata(self): """Metadata is read correctly from BufrMessage.""" with BufrFile(TESTBUFR) as bufr_file: msg = BufrMessage(bufr_file) msg.unpack() msg_keys = list(msg.keys()) self.assertEqual(len(msg_keys), 146) for key in KNOWN_BUFR_KEYS: assert key in msg_keys # Size of message in bytes self.assertEqual(msg.size(), 220) self.assertEqual(len(list(msg.keys())), len(msg))
def test_metadata(self): """Metadata is read correctly from BufrMessage.""" with BufrFile(TESTBUFR) as bufr_file: msg = BufrMessage(bufr_file) msg.unpack() msg_keys = msg.keys() self.assertEqual(len(msg_keys), 140) for key in KNOWN_BUFR_KEYS: assert key in msg_keys # Size of message in bytes self.assertEqual(msg.size(), 220) self.assertEqual(len(msg.keys()), len(msg))
def test_clone(self): """Messages can be used to produce clone Messages.""" with BufrFile(TESTBUFR) as bufr_file: msg = BufrMessage(bufr_file) msg2 = BufrMessage(clone=msg) self.assertSequenceEqual(list(msg.keys()), list(msg2.keys()))
def test_clone(self): """Messages can be used to produce clone Messages.""" with BufrFile(TESTBUFR) as bufr_file: msg = BufrMessage(bufr_file) msg2 = BufrMessage(clone=msg) self.assertSequenceEqual(msg.keys(), msg2.keys())