bool_function_examples

This script provides several examples of how one can use the test helper package to test boolean functions (i.e., functions that return True or False). With the runtime arguments below, the user can select which boolean examples they would like to run. If no runtime flags are used, this script will run all of the boolean test examples.

Parameters

—run_always_true_demobool, default False

Boolean flag for whether the always true function example should be run.

—run_always_false_demobool, default False

Boolean flag for whether the always false function example should be run.

—run_is_int_demobool, default False

Boolean flag for whether the is int function example should be run.

—run_is_int_error_if_false_demobool, default False

Boolean flag for whether the is int with type error if false function example should be run.

—run_can_convert_to_int_demobool, default False

Boolean flag for whether the can convert to int function example should be run.

—run_list_has_val_demobool, default False

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

Module Contents

Functions

always_true

Function that always returns True.

always_false

Function that always returns False.

is_int

Function that returns True if val is an integer and False if it is not.

is_int_error_if_false

Function that returns True if val is an integer raises a TypeError if it is not.

can_convert_to_int

Function that returns True if val is an integer or can be converted to an integer and False otherwise.

list_has_val

Function that checks whether val_to_find is an element in search_list.

Data

parser

Runtime argument parser

args

Parsed runtime arguments

run_always_true_demo

Runtime flag for whether we should run the always true function example

run_always_false_demo

Runtime flag for whether we should run the always false function example

run_is_int_demo

Runtime flag for whether we should run the is integer function example

run_is_int_error_if_false_demo

Runtime flag for whether we should run the is integer error if false function example

run_can_convert_to_int_demo

Runtime flag for whether we should run the can convert to int function example

run_list_has_val_demo

Runtime flag for whether we should run the list has value function example

any_demos

Boolean for whether any demos were requested by the user (through the runtime arguments)

run_all_demos

Boolean for whether all demos should be run (default behaviour if no specific demos are requested)

API

bool_function_examples.parser = 'ArgumentParser(...)'

Runtime argument parser

bool_function_examples.args = 'parse_args(...)'

Parsed runtime arguments

bool_function_examples.run_always_true_demo = None

Runtime flag for whether we should run the always true function example

bool_function_examples.run_always_false_demo = None

Runtime flag for whether we should run the always false function example

bool_function_examples.run_is_int_demo = None

Runtime flag for whether we should run the is integer function example

bool_function_examples.run_is_int_error_if_false_demo = None

Runtime flag for whether we should run the is integer error if false function example

bool_function_examples.run_can_convert_to_int_demo = None

Runtime flag for whether we should run the can convert to int function example

bool_function_examples.run_list_has_val_demo = None

Runtime flag for whether we should run the list has value function example

bool_function_examples.any_demos = None

Boolean for whether any demos were requested by the user (through the runtime arguments)

bool_function_examples.run_all_demos = None

Boolean for whether all demos should be run (default behaviour if no specific demos are requested)

bool_function_examples.always_true()

Function that always returns True.

bool_function_examples.always_false()

Function that always returns False.

bool_function_examples.is_int(val)

Function that returns True if val is an integer and False if it is not.

bool_function_examples.is_int_error_if_false(val)

Function that returns True if val is an integer raises a TypeError if it is not.

bool_function_examples.can_convert_to_int(val)

Function that returns True if val is an integer or can be converted to an integer and False otherwise.

bool_function_examples.list_has_val(search_list, val_to_find)

Function that checks whether val_to_find is an element in search_list.