added hex methods
This commit is contained in:
@@ -91,6 +91,18 @@ class TestBytes(TestCase):
|
||||
with self.assertRaises(TypeError, msg="Bytes(\"1234\")"):
|
||||
Bytes("1234")
|
||||
|
||||
def test_hex(self):
|
||||
"""
|
||||
Test conversion to hex string
|
||||
"""
|
||||
with self.subTest("Test hex() function"):
|
||||
self.assertEqual(Bytes(1234).hex(), "04d2",
|
||||
f"Bytes(1234).hex() == '04d2'")
|
||||
self.assertEqual(Bytes(1234).hex(":"), "04:d2",
|
||||
f"Bytes(1234).hex(':') == '04:d2'")
|
||||
self.assertEqual(Bytes(1234).hex(":", 1), "04:d2",
|
||||
f"Bytes(1234).hex(':', 1) == '04:d2'")
|
||||
|
||||
def test_comparison_operators(self):
|
||||
"""
|
||||
Test the comparison operators with Bytes objects
|
||||
|
||||
Reference in New Issue
Block a user