2015-08-21 06:56:14 -04:00
|
|
|
# test builtin type
|
|
|
|
|
|
|
|
print(type(int))
|
|
|
|
|
|
|
|
try:
|
|
|
|
type()
|
|
|
|
except TypeError:
|
|
|
|
print('TypeError')
|
|
|
|
|
|
|
|
try:
|
|
|
|
type(1, 2)
|
|
|
|
except TypeError:
|
|
|
|
print('TypeError')
|
2018-03-25 17:05:32 -04:00
|
|
|
|
|
|
|
# second arg should be a tuple
|
|
|
|
try:
|
|
|
|
type('abc', None, None)
|
|
|
|
except TypeError:
|
|
|
|
print('TypeError')
|
|
|
|
|
|
|
|
# third arg should be a dict
|
|
|
|
try:
|
|
|
|
type('abc', (), None)
|
|
|
|
except TypeError:
|
|
|
|
print('TypeError')
|
|
|
|
|
|
|
|
# elements of second arg (the bases) should be types
|
|
|
|
try:
|
|
|
|
type('abc', (1,), {})
|
|
|
|
except TypeError:
|
|
|
|
print('TypeError')
|