DarkmatterVale/regex4dummies

View on GitHub
regex4dummies/tests/main.py

Summary

Maintainability
A
0 mins
Test Coverage
from semantic_tests import RunSemanticTests
from topic_analysis import RunTopicAnalysisTests
from toolkit_tests import ToolkitTests
from literal_tests import LiteralParserTests

"""
This class runs tests for all of the functions of regex4dummies.
"""


class MainTests:
    def __init__(self, *args, **kwargs):
        """
        Constructor method.
        """

        # Displaying test information
        print("")
        print("This program will test regex4dummies' functions. This is not an accuracy tester (see the program located under examples)")
        print("")
        print("The following functions will be tested: ")
        print("- Semantic parsing ( nltk )")
        print("- Literal parsing ( default )")
        print("- Topic analysis")
        print("- Toolkit functions ( all )")
        print("")
        print("--------------------------------------------")
        print("")

    def run_tests(self, regex4dummies_object, toolkit_object):
        """
        Runs tests on regex4dummies' functions,
        including:
        - semantic parsers
        - topic analysis
        - Toolkit functions
        """

        # Instantiating test objects
        semantic_test_runner = RunSemanticTests()
        topic_analysis_test_runner = RunTopicAnalysisTests()
        toolkit_test_runner = ToolkitTests()
        literal_test_runner = LiteralParserTests()

        # Running tests
        semantic_test_runner.run_tests(regex4dummies_object)
        topic_analysis_test_runner.run_tests(regex4dummies_object)
        toolkit_test_runner.run_tests(toolkit_object)
        literal_test_runner.run_tests(regex4dummies_object)