string_function_examples¶
This script provides several examples of how one can use the test helper package to validate functions that receive or generate string values. The optional runtime arguments below allow the user to select which string examples they would like to run. If no runtime flags are used, this script will run all of the built-in string examples.
Parameters¶
- —run_empty_string_demobool, default False
Boolean flag for whether the empty string example should be run.
- —run_single_char_demobool, default False
Boolean flag for whether the single character string example should be run.
- —run_multi_char_demobool, default False
Boolean flag for whether the multiple-character string example should be run.
- —run_multiply_string_demobool, default False
Boolean flag for whether the multiply string example should be run.
- —run_concat_strings_demobool, default False
Boolean flag for whether the concatenate strings example should be run.
- —run_remove_vowels_demobool, default False
Boolean flag for whether the remove vowels example should be run.
Module Contents¶
Functions¶
Returns empty string. |
|
Returns single character string (output depends on the value of the DEFAULT_CHAR constant). |
|
Return string with multiple characters (output depends on the value of the DEFAULT_MULTI_CHAR_STR constant). |
|
Returns the concatenation of two strings. |
|
Returns the inputted string multiplied by a requested number of repetitions. |
|
Returns a copy of the input string with all vowels removed. |
Data¶
Default one-character string. |
|
Default multiple-character string. |
|
Parser for optional runtime arguments. |
|
Parsed runtime arguments. |
|
Runtime flag for whether we should run the empty string example. |
|
Runtime flag for whether we should run the single character string example. |
|
Runtime flag for whether we should run the multiple character string example. |
|
Runtime flag for whether we should run the multiply string example. |
|
Runtime flag for whether we should run the concatenate strings example. |
|
Runtime flag for whether we should run the remove vowels demo. |
|
Boolean for whether any demos were requested by the user (through the runtime arguments). |
|
Boolean for whether all demos should be run (default behaviour if no specific demos are requested). |
API¶
- string_function_examples.DEFAULT_CHAR = 'a'¶
Default one-character string.
- string_function_examples.DEFAULT_MULTI_CHAR_STR = 'abc'¶
Default multiple-character string.
- string_function_examples.parser = 'ArgumentParser(...)'¶
Parser for optional runtime arguments.
- string_function_examples.args = 'parse_args(...)'¶
Parsed runtime arguments.
- string_function_examples.run_empty_string_demo = None¶
Runtime flag for whether we should run the empty string example.
- string_function_examples.run_single_char_demo = None¶
Runtime flag for whether we should run the single character string example.
- string_function_examples.run_multi_char_demo = None¶
Runtime flag for whether we should run the multiple character string example.
- string_function_examples.run_multiply_string_demo = None¶
Runtime flag for whether we should run the multiply string example.
- string_function_examples.run_concat_strings_demo = None¶
Runtime flag for whether we should run the concatenate strings example.
- string_function_examples.run_remove_vowels_demo = None¶
Runtime flag for whether we should run the remove vowels demo.
- string_function_examples.any_demos = None¶
Boolean for whether any demos were requested by the user (through the runtime arguments).
- string_function_examples.run_all_demos = None¶
Boolean for whether all demos should be run (default behaviour if no specific demos are requested).
- string_function_examples.return_empty_string()¶
Returns empty string.
- string_function_examples.return_single_char()¶
Returns single character string (output depends on the value of the DEFAULT_CHAR constant).
- string_function_examples.return_multi_char_string()¶
Return string with multiple characters (output depends on the value of the DEFAULT_MULTI_CHAR_STR constant).
- string_function_examples.concat_strings(str1, str2)¶
Returns the concatenation of two strings.
- string_function_examples.multiply_string(str_to_multiply, num_repeats)¶
Returns the inputted string multiplied by a requested number of repetitions.
- string_function_examples.remove_vowels(str_val)¶
Returns a copy of the input string with all vowels removed.