list_function_examples

Script demonstrating how we can use the test helper package to evaluate functions that receive or generate Python lists. The optional runtime arguments below allow the user to choose which list examples they would like to run. If no runtime flags are used, this script will run all of the list examples.

Parameters

—run_empty_list_demobool, default False

Boolean flag for whether the empty list example should be run.

—run_single_element_list_demobool, default False

Boolean flag for whether the single-element list example should be run.

—run_multi_element_list_demobool, default False

Boolean flag for whether the multiple-element list example should be run.

—run_nested_list_demobool, default False

Boolean flag for whether the nested list function example should be run.

—run_search_list_demobool, default False

Boolean flag for whether the search list example should be run.

—run_concat_lists_demobool, default False

Boolean flag for whether the concatenate lists example should be run.

Module Contents

Functions

return_empty_list

Returns an empty list.

return_one_element_list

Returns a list with one element.

return_multi_element_list

Returns a list with multiple elements.

return_nested_list

Returns a nested list.

find_int_vals_in_list

Returns a list with all the integer values in the list_to_search parameter.

concat_lists

Returns the result of concatenating two lists (list1 and list2).

Data

DEFAULT_INT_VAL

Default integer value that should be used when constructing input lists.

DEFAULT_ONE_ELEMENT_LIST

Default list with only one element (contains the default integer value).

DEFAULT_MULTI_ELEMENT_LIST

Default list with more than one element (contains the default integer value and the two integers that come after it).

DEFAULT_NESTED_LIST

Default nested list (i.e., a list that contains lists as elements).

parser

Parser for runtime arguments.

args

Parsed runtime arguments.

run_empty_list_demo

Runtime flag for whether we should run the empty list example.

run_one_element_list_demo

Runtime flag for whether we should run the single-element list example.

run_multi_element_list_demo

Runtime flag for whether we should run multiple-element list example.

run_nested_list_demo

Runtime flag for whether we should run the nested list example.

run_search_list_demo

Runtime flag for whether we should run the search list example.

run_concat_lists_demo

Runtime flag for whether we should run the concatenated list example.

any_demos

Boolean for whether the user has selected any demos with the runtime flags.

run_all_demos

Boolean for whether all demos should be run (default behaviour if no runtime flags are used).

API

list_function_examples.DEFAULT_INT_VAL = 0

Default integer value that should be used when constructing input lists.

list_function_examples.DEFAULT_ONE_ELEMENT_LIST = None

Default list with only one element (contains the default integer value).

list_function_examples.DEFAULT_MULTI_ELEMENT_LIST = None

Default list with more than one element (contains the default integer value and the two integers that come after it).

list_function_examples.DEFAULT_NESTED_LIST = [None, None, None]

Default nested list (i.e., a list that contains lists as elements).

list_function_examples.parser = 'ArgumentParser(...)'

Parser for runtime arguments.

list_function_examples.args = 'parse_args(...)'

Parsed runtime arguments.

list_function_examples.run_empty_list_demo = None

Runtime flag for whether we should run the empty list example.

list_function_examples.run_one_element_list_demo = None

Runtime flag for whether we should run the single-element list example.

list_function_examples.run_multi_element_list_demo = None

Runtime flag for whether we should run multiple-element list example.

list_function_examples.run_nested_list_demo = None

Runtime flag for whether we should run the nested list example.

list_function_examples.run_search_list_demo = None

Runtime flag for whether we should run the search list example.

list_function_examples.run_concat_lists_demo = None

Runtime flag for whether we should run the concatenated list example.

list_function_examples.any_demos = None

Boolean for whether the user has selected any demos with the runtime flags.

list_function_examples.run_all_demos = None

Boolean for whether all demos should be run (default behaviour if no runtime flags are used).

list_function_examples.return_empty_list()

Returns an empty list.

list_function_examples.return_one_element_list()

Returns a list with one element.

list_function_examples.return_multi_element_list()

Returns a list with multiple elements.

list_function_examples.return_nested_list()

Returns a nested list.

list_function_examples.find_int_vals_in_list(list_to_search)

Returns a list with all the integer values in the list_to_search parameter.

list_function_examples.concat_lists(list1, list2)

Returns the result of concatenating two lists (list1 and list2).