Add packed roundtrip test

This commit is contained in:
Jason Paryani
2013-09-03 22:16:13 -07:00
parent f80caf6c4c
commit 5e8745c365

View File

@@ -67,6 +67,15 @@ def test_roundtrip_file(addressbook):
msg = addressbook.AddressBook.read(f) msg = addressbook.AddressBook.read(f)
check_msg(msg) check_msg(msg)
def test_roundtrip_file_packed(addressbook):
f = open('example', 'w')
msg = build_message(addressbook)
msg.write_packed(f)
f = open('example', 'r')
msg = addressbook.AddressBook.read_packed(f)
check_msg(msg)
def test_roundtrip_bytes(addressbook): def test_roundtrip_bytes(addressbook):
msg = build_message(addressbook) msg = build_message(addressbook)
message_bytes = msg.to_bytes() message_bytes = msg.to_bytes()