@@ -578,12 +578,12 @@ from testutil import assertRaises
578578def to_bytes(n: int, length: int, byteorder: str, signed: bool = False) -> bytes:
579579 return n.to_bytes(length, byteorder, signed=signed)
580580def test_to_bytes() -> None:
581- assert to_bytes(255, 2, "big") == b'\x00\xff'
582- assert to_bytes(255, 2, "little") == b'\xff\x00'
583- assert to_bytes(-1, 2, "big", True) == b'\xff\xff'
584- assert to_bytes(0, 1, "big") == b'\x00'
581+ assert to_bytes(255, 2, "big") == b'\x00\xff', to_bytes(255, 2, "big")
582+ assert to_bytes(255, 2, "little") == b'\xff\x00', to_bytes(255, 2, "little")
583+ assert to_bytes(-1, 2, "big", True) == b'\xff\xff', to_bytes(-1, 2, "big", True)
584+ assert to_bytes(0, 1, "big") == b'\x00', to_bytes(0, 1, "big")
585585 # test with a value that does not fit in 64 bits
586- assert to_bytes(10**30, 16, "big") == b'\x00\x00\x00\x0c\x9f,\x9c\xd0Ft\xed\xea@\x00\x00\x00'
586+ assert to_bytes(10**30, 16, "big") == b'\x00\x00\x00\x0c\x9f,\x9c\xd0Ft\xed\xea@\x00\x00\x00', to_bytes(10**30, 16, "big")
587587 # unsigned, too large for 1 byte
588588 with assertRaises(OverflowError):
589589 to_bytes(256, 1, "big")
0 commit comments