TestInitializeFlexPreprocessor package

Submodules

TestInitializeFlexPreprocessor.test_InitializeFlexPreprocessor module

This module is responsible for testing the InitializeFlexPreprocessor.py module

The dictionary containing the correct key & preprocessor pair is initialized here as pp_dict. The list containing the default selection and sequence of preprocessors is initialized here as default_pp.

TestInitializeFlexPreprocessor.test_InitializeFlexPreprocessor.test_init_flex_pp_1()

Tests a valid user input (only gray scale).

This test asserts that the InitializeFlexPreprocessor module returns the correct preprocessor (i.e. gray scale) based on a user input of ‘1’. The values 1-6 are keys for corresponding preprocessors as defined in the dictionary pp_dict.

TestInitializeFlexPreprocessor.test_InitializeFlexPreprocessor.test_init_flex_pp_4_1()

Tests an invalid user input (binary threshold before gray scale).

This test handles two user inputs: an invalid one (‘4,2,1’) followed by a valid input (‘1,2,4’). The first input is invalid because the input image for the binary threshold function should be gray scale. In other words, the image has to pass through the gray scale function (‘1’) before passing the binary threshold module (‘4’).

The first assertion checks if the InitializeFlexPreprocessor module prints the correct warning to stdout when an invalid input is used. The second assertion checks whether the module returns the correct list containing the selection and sequence of preprocessors following the correct user input.

TestInitializeFlexPreprocessor.test_InitializeFlexPreprocessor.test_init_flex_pp_4()

Tests an invalid user input (choosing only binary threshold without gray scale).

This test handles an invalid and a valid input. The first assertion checks whether the InitializeFlexPreprocessor module prints the correct warning message to stdout when an invalid input is used (i.e. only choosing binary threshold without gray scale). The second assertion checks whether the correct list of preprocessors is returned by the module based on the following correct input.

TestInitializeFlexPreprocessor.test_InitializeFlexPreprocessor.test_init_flex_pp_a0()

Tests an invalid user input (invalid input characters).

This test handles three user inputs. The first two contain invalid input characters. The third one is valid. The first two inputs contain invalid characters (i.e. ‘a’ and ‘9’ respectively). The test asserts whether the InitializeFlexPreprocessor module prints the correct warning message to stdout. The second assertion checks whether the module returns a correct list of preprocessors based on valid user input.

TestInitializeFlexPreprocessor.test_InitializeFlexPreprocessor.test_init_flex_pp_55()

Tests an invalid user input (choosing duplicate preprocessors).

This test handles an incorrect user input containing a duplicate (‘1,2,5,5’), as well as a correct input. The test asserts whether the InitializeFlexPreprocessor module prints the correct warning message to stdout. The second assertion checks whether the correct list of preprocessors is returned based on valid user input.

TestInitializeFlexPreprocessor.test_InitializeFlexPreprocessor.test_init_flex_pp_default()

Tests the default selection and sequence of preprocessors as defined in the list default_pp.

The test handles a single user input. It simulates the “Enter” key being pressed. Hence, the input is (‘’). This triggers the default setting of preprocessors in InitializeFlexPreprocessor. The assertion in this test checks whether the module returns the correct list of preprocessors.

Module contents