From 1864f90e9a2c0cc12e91c88ddd491b809c5317e5 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sun, 22 Jan 2017 11:49:08 +1100 Subject: [PATCH] tests: Add test for builtin help function. --- tests/basics/builtin_help.py | 17 +++++++++++++++++ tests/basics/builtin_help.py.exp | 14 ++++++++++++++ tests/run-tests | 2 +- 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 tests/basics/builtin_help.py create mode 100644 tests/basics/builtin_help.py.exp diff --git a/tests/basics/builtin_help.py b/tests/basics/builtin_help.py new file mode 100644 index 0000000000..902a95175b --- /dev/null +++ b/tests/basics/builtin_help.py @@ -0,0 +1,17 @@ +# test builtin help function + +try: + help +except NameError: + print("SKIP") + import sys + sys.exit() + +help() # no args +help(help) # help for a function +help(int) # help for a class +help(1) # help for an instance +import micropython +help(micropython) # help for a module + +print('done') # so last bit of output is predictable diff --git a/tests/basics/builtin_help.py.exp b/tests/basics/builtin_help.py.exp new file mode 100644 index 0000000000..ed8a7d74b8 --- /dev/null +++ b/tests/basics/builtin_help.py.exp @@ -0,0 +1,14 @@ +######## +object is of type function +object is of type type + from_bytes -- + to_bytes -- +object 1 is of type int + from_bytes -- + to_bytes -- +object is of type module + __name__ -- micropython + const -- + opt_level -- +######## +done diff --git a/tests/run-tests b/tests/run-tests index b835047a27..6834d59bef 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -51,7 +51,7 @@ def convert_regex_escapes(line): def run_micropython(pyb, args, test_file): - special_tests = ('micropython/meminfo.py', 'basics/bytes_compare3.py', 'thread/thread_exc2.py') + special_tests = ('micropython/meminfo.py', 'basics/bytes_compare3.py', 'basics/builtin_help.py', 'thread/thread_exc2.py') is_special = False if pyb is None: # run on PC