summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/bytearray_construct.py
blob: eb4d4e641f0ca2a475c1d158a5c69d92becc0d9c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
# test construction of bytearray from different objects

print(bytearray(b'123'))
print(bytearray('1234', 'utf-8'))
print(bytearray('12345', 'utf-8', 'strict'))
print(bytearray((1, 2)))
print(bytearray([1, 2]))

try:
    print(bytearray('1234'))
except TypeError:
    print("TypeError")