Add Python3 support to thread-cert. (#985)

This commit is contained in:
PFierek
2016-11-17 21:16:59 +08:00
committed by Jonathan Hui
parent 78047488b6
commit fba3198c9e
17 changed files with 118 additions and 92 deletions
+5 -1
View File
@@ -30,6 +30,7 @@
import io
import ipaddress
import struct
import sys
import common
import ipv6
@@ -193,7 +194,10 @@ class Message(object):
assert sent_to_node == True
def assertSentToDestinationAddress(self, ipv6_address):
assert self.ipv6_packet.ipv6_header.destination_address == ipaddress.ip_address(unicode(ipv6_address))
if sys.version_info[0] == 2:
ipv6_address = ipv6_address.decode("utf-8")
assert self.ipv6_packet.ipv6_header.destination_address == ipaddress.ip_address(ipv6_address)
def assertSentWithHopLimit(self, hop_limit):
assert self.ipv6_packet.ipv6_header.hop_limit == hop_limit