diff options
author | Paul Vinciguerra <pvinci@vinciconsulting.com> | 2019-03-06 08:23:58 -0800 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2019-03-07 22:29:00 +0000 |
commit | ea2450fa2d1e8ba0295ea9861a404796100dad1e (patch) | |
tree | abc11c27a65c8af6f839ea0af73cac5560933c3b /test/test_classifier_ip6.py | |
parent | 4a4cea02ef82793232cab4d878baca5cf0134966 (diff) |
VPP-1508: Python3 tests. Explicitly specify string formatting.
.format() doesn't understand what to do with binary values by default.
Specify that we expect coersion to string.
Change-Id: Ic4b697f70852124dc85ab231f76b7934d0d71f4d
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'test/test_classifier_ip6.py')
-rw-r--r-- | test/test_classifier_ip6.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/test_classifier_ip6.py b/test/test_classifier_ip6.py index f6d12c7b3db..30ad48c8531 100644 --- a/test/test_classifier_ip6.py +++ b/test/test_classifier_ip6.py @@ -168,7 +168,7 @@ class TestClassifier(VppTestCase): :param str dst_port: destination port number <0-ffff> """ - return ('{:0>14}{:0>34}{:0>32}{:0>4}{:0>4}'.format( + return ('{!s:0>14}{!s:0>34}{!s:0>32}{!s:0>4}{!s:0>4}'.format( nh, src_ip, dst_ip, src_port, dst_port)).rstrip('0') @staticmethod @@ -190,7 +190,7 @@ class TestClassifier(VppTestCase): dst_ip = binascii.hexlify(socket.inet_pton( socket.AF_INET6, dst_ip)) - return ('{:0>14}{:0>34}{:0>32}{:0>4}{:0>4}'.format( + return ('{!s:0>14}{!s:0>34}{!s:0>32}{!s:0>4}{!s:0>4}'.format( hex(nh)[2:], src_ip, dst_ip, hex(src_port)[2:], hex(dst_port)[2:])).rstrip('0') @@ -203,8 +203,8 @@ class TestClassifier(VppTestCase): :param str ether_type: ethernet type <0-ffff> """ - return ('{:0>12}{:0>12}{:0>4}'.format(dst_mac, src_mac, - ether_type)).rstrip('0') + return ('{!s:0>12}{!s:0>12}{!s:0>4}'.format( + dst_mac, src_mac, ether_type)).rstrip('0') @staticmethod def build_mac_match(dst_mac='', src_mac='', ether_type=''): @@ -219,8 +219,8 @@ class TestClassifier(VppTestCase): if src_mac: src_mac = src_mac.replace(':', '') - return ('{:0>12}{:0>12}{:0>4}'.format(dst_mac, src_mac, - ether_type)).rstrip('0') + return ('{!s:0>12}{!s:0>12}{!s:0>4}'.format( + dst_mac, src_mac, ether_type)).rstrip('0') def create_classify_table(self, key, mask, data_offset=0): """Create Classify Table |