Skip to content

Commit 1864f90

Browse files
committed
tests: Add test for builtin help function.
1 parent 51c89e4 commit 1864f90

3 files changed

Lines changed: 32 additions & 1 deletion

File tree

tests/basics/builtin_help.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# test builtin help function
2+
3+
try:
4+
help
5+
except NameError:
6+
print("SKIP")
7+
import sys
8+
sys.exit()
9+
10+
help() # no args
11+
help(help) # help for a function
12+
help(int) # help for a class
13+
help(1) # help for an instance
14+
import micropython
15+
help(micropython) # help for a module
16+
17+
print('done') # so last bit of output is predictable

tests/basics/builtin_help.py.exp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
########
2+
object <function> is of type function
3+
object <class 'int'> is of type type
4+
from_bytes -- <classmethod>
5+
to_bytes -- <function>
6+
object 1 is of type int
7+
from_bytes -- <classmethod>
8+
to_bytes -- <function>
9+
object <module 'micropython'> is of type module
10+
__name__ -- micropython
11+
const -- <function>
12+
opt_level -- <function>
13+
########
14+
done

tests/run-tests

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def convert_regex_escapes(line):
5151

5252

5353
def run_micropython(pyb, args, test_file):
54-
special_tests = ('micropython/meminfo.py', 'basics/bytes_compare3.py', 'thread/thread_exc2.py')
54+
special_tests = ('micropython/meminfo.py', 'basics/bytes_compare3.py', 'basics/builtin_help.py', 'thread/thread_exc2.py')
5555
is_special = False
5656
if pyb is None:
5757
# run on PC

0 commit comments

Comments
 (0)