python3: Modify a literal argument in a bytes method call to bytes type

Signed-off-by: Fumihiko Kakuma <kakuma@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
fumihiko kakuma 2015-06-29 16:00:57 +09:00 committed by FUJITA Tomonori
parent 815dc505b7
commit 4099aec69a
2 changed files with 4 additions and 4 deletions

View File

@ -333,7 +333,7 @@ class OFPPort(ofproto_parser.namedtuple('OFPPort', (
i = cls._fields.index('hw_addr')
port[i] = addrconv.mac.bin_to_text(port[i])
i = cls._fields.index('name')
port[i] = port[i].rstrip('\0')
port[i] = port[i].rstrip(b'\0')
return cls(*port)
@ -1985,7 +1985,7 @@ class OFPDescStats(ofproto_parser.namedtuple('OFPDescStats', (
desc = struct.unpack_from(ofproto.OFP_DESC_STATS_PACK_STR,
buf, offset)
desc = list(desc)
desc = [x.rstrip('\0') for x in desc]
desc = [x.rstrip(b'\0') for x in desc]
stats = cls(*desc)
stats.length = ofproto.OFP_DESC_STATS_SIZE
return stats
@ -2375,7 +2375,7 @@ class OFPTableStats(
buf, offset)
table = list(table)
i = cls._fields.index('name')
table[i] = table[i].rstrip('\0')
table[i] = table[i].rstrip(b'\0')
stats = cls(*table)
stats.length = ofproto.OFP_TABLE_STATS_SIZE
return stats

View File

@ -4985,7 +4985,7 @@ class TestOFPTableStats(unittest.TestCase):
res = OFPTableStats.parser(buf, 0)
eq_(table_id, res.table_id)
eq_(name, res.name.replace(b'\x00', ''))
eq_(name, res.name.replace(b'\x00', b''))
eq_(match, res.match)
eq_(wildcards, res.wildcards)
eq_(write_actions, res.write_actions)