Test module: custom_callables.py

custom_callables.py

A module containing tests for the standard argparser custom callables I’m using in custom_callables.py. These tests use the standard unittest package and extend the unittest.TestCase class.

module_version:1.0
created_on:2013-04-08

Custom callable tests

class tests.custom_callables.TestParsingRoutines(methodName='runTest')[source]

Test the function defined in custom_callables.py.

Each function is tested with existing and non-existent instances of the file or path type that it is designed for. We also test that providing non- string basic python objects produces string representations and doesn’t case a failure.

setUp()[source]

Initialize the framework for testing.

Define and create a new system temporary directory with the tempfile package for use as an existing directory. A file called thisfileexists.txt is created in this directory as an existing file. Two new paths that do not exist, one a fake sub-directory in the existing directory and the other a fake file in this fake directory, are constructed.

tearDown()[source]

Remove testing framework.

Deletes the created temporary directory and thisfileexists.txt file.

test_input_file()[source]

Test the input_file function.

Test object Expectation
Existing file Return full file path
Non-existent file Raise argparse.ArgumentTypeError exception
Non-string arg Raise TypeError exception
test_input_path()[source]

Test the input_path function.

Test object Expectation
Existing path Return full path
Non-existent path Raise argparse.ArgumentTypeError exception
Non-string arg Raise TypeError exception
test_output_file()[source]

Test the output_file function.

Test object Expectation
Existing file Return full file path
Non-existent file Create path (but not file) & return full path
Non-string arg Raise TypeError exception
test_output_path()[source]

Test the output_path function.

Test object Expectation
Existing path Return full path
Non-existent path Create path & return full path
Non-string arg Raise TypeError exception

Table Of Contents

Previous topic

Test module: standard_parsers.py

Next topic

Test module: standard_logging.py

This Page