workon Bytes

This commit is contained in:
2020-10-15 04:07:34 +00:00
parent f5f6813326
commit 535ef1d42b
2 changed files with 50 additions and 7 deletions

View File

@@ -19,7 +19,7 @@ class TestBytes(TestCase):
test_list_of_ints = [[0]]
test_list_of_str = [["0"] * 8]
for i in range(0, 100):
max_value = int("9" * randint(0, 25))
max_value = int("9" * randint(1, 25))
test_value = randint(1, max_value)
bitesize = ceil(test_value.bit_length() / 8)
pad_bits = "0" * ((bitesize * 8) - test_value.bit_length())
@@ -35,8 +35,8 @@ class TestBytes(TestCase):
list_of_str = []
for bite in bites:
list_of_Bits.append(Bits(bite))
list_of_bytes.append(bite)
list_of_int.append(ord(bite))
list_of_bytes.append(bytes([bite]))
list_of_ints.append(bite)
list_of_str.append(Bits(bite).bin())
for bit in Bits(bite).bin():
list_of_Bit.append(Bit(bit))
@@ -45,6 +45,7 @@ class TestBytes(TestCase):
test_list_of_bytes.append(list_of_bytes)
test_list_of_Bits.append(list_of_Bits)
test_list_of_Bit.append(list_of_Bit)
test_list_of_ints.append(list_of_ints)
test_list_of_str.append(list_of_str)
self.testcases = {"int": test_ints,
"str": test_str,
@@ -86,7 +87,7 @@ class TestBytes(TestCase):
Test the comparison operators with Bytes objects
"""
with self.subTest("Bytes Type"):
self.assertEqual(Bytes(
pass
with self.subTest("int Type"):
self.assertEqual(Bytes(1234), 1234,
"Bytes(1234) == 1234")