1# test construction of bytes from different objects 2 3# tuple, list 4print(bytes((1, 2))) 5print(bytes([1, 2])) 6 7# constructor value out of range 8try: 9 bytes([-1]) 10except ValueError: 11 print('ValueError') 12 13# constructor value out of range 14try: 15 bytes([256]) 16except ValueError: 17 print('ValueError') 18 19# error in construction 20try: 21 a = bytes([1, 2, 3], 1) 22except TypeError: 23 print('TypeError') 24