mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-19 19:10:17 +00:00
add test cases
This commit is contained in:
parent
71daaf7592
commit
0443cbcb16
@ -42,4 +42,10 @@ from math import (
|
||||
pow,
|
||||
sin,
|
||||
cos
|
||||
)
|
||||
)
|
||||
|
||||
# test reload (dummy)
|
||||
import importlib
|
||||
importlib.reload(test2.a)
|
||||
|
||||
assert __import__('math').pi > 3
|
||||
|
@ -172,13 +172,22 @@ class A:
|
||||
def __call__(self):
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def staticmethod():
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def classmethod(cls):
|
||||
pass
|
||||
|
||||
assert callable(A) is True # type
|
||||
assert callable(A()) is True # instance with __call__
|
||||
assert callable(A.__call__) is True # bound method
|
||||
assert callable(A.__init__) is True # bound method
|
||||
assert callable(print) is True # builtin function
|
||||
assert callable(isinstance) is True # builtin function
|
||||
|
||||
assert callable(A.staticmethod) is True # staticmethod
|
||||
assert callable(A.classmethod) is True # classmethod
|
||||
|
||||
assert id(0) is None
|
||||
assert id(2**62) is None
|
||||
@ -241,3 +250,8 @@ assert min([
|
||||
|
||||
assert min(1, 2) == 1
|
||||
assert max(1, 2) == 2
|
||||
|
||||
def fn(): pass
|
||||
assert repr(fn).startswith('<function fn at')
|
||||
|
||||
assert repr(round) == '<nativefunc object>'
|
Loading…
x
Reference in New Issue
Block a user