Browse Source

add test cases

blueloveTH 11 tháng trước cách đây
mục cha
commit
0443cbcb16
2 tập tin đã thay đổi với 22 bổ sung2 xóa
  1. 7 1
      tests/30_import.py
  2. 15 1
      tests/77_builtin_func_2.py

+ 7 - 1
tests/30_import.py

@@ -42,4 +42,10 @@ from math import (
     pow,
     sin,
     cos
-)
+)
+
+# test reload (dummy)
+import importlib
+importlib.reload(test2.a)
+
+assert __import__('math').pi > 3

+ 15 - 1
tests/77_builtin_func_2.py

@@ -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>'