diff options
Diffstat (limited to 'ryu/tests/unit/test_utils.py')
-rw-r--r-- | ryu/tests/unit/test_utils.py | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/ryu/tests/unit/test_utils.py b/ryu/tests/unit/test_utils.py index 64886c3c..303e2918 100644 --- a/ryu/tests/unit/test_utils.py +++ b/ryu/tests/unit/test_utils.py @@ -31,19 +31,27 @@ class Test_utils(unittest.TestCase): pass def test_hex_array_string(self): - ''' Test string conversion into array of hexes ''' - expected_result = '0x1 0x2 0x3 0x4' - data = b'\01\02\03\04' + """ + Test hex_array() with str type. + """ + expected_result = '0x01 0x02 0x03 0x04' + data = b'\x01\x02\x03\x04' eq_(expected_result, utils.hex_array(data)) def test_hex_array_bytearray(self): - ''' Test bytearray conversion into array of hexes ''' - expected_result = '0x1 0x2 0x3 0x4' - data = bytearray(b'\01\02\03\04') + """ + Test hex_array() with bytearray type. + """ + expected_result = '0x01 0x02 0x03 0x04' + data = bytearray(b'\x01\x02\x03\x04') eq_(expected_result, utils.hex_array(data)) - def test_hex_array_invalid(self): - ''' Test conversion into array of hexes with invalid data type ''' - expected_result = None - data = 1234 + def test_hex_array_bytes(self): + """ + Test hex_array() with bytes type. (Python3 only) + """ + if six.PY2: + return + expected_result = '0x01 0x02 0x03 0x04' + data = bytes(b'\x01\x02\x03\x04') eq_(expected_result, utils.hex_array(data)) |