def test_question_mark_operator_false(self): #get the results of the function result = project.match(self.m, self.o) #the expected result expected = False self.assertEqual(expected, result)
def test_or_operator_true(self): #get the results of the function result = project.match(self.g, self.h) #the expected result expected = True self.assertEqual(expected, result)
def test_plus_operator_true(self): #get the results of the function result = project.match(self.j, self.k) #the expected result expected = False self.assertEqual(expected, result)
def test_kleene_operator_false(self): #get the results of the function result = project.match(self.d, self.f) #the expected result expected = False self.assertEqual(expected, result)
def test_regex_example_false1(self): #get the results of the function result = project.match("a.b.c*", "adfbc") #the expected result expected = False self.assertEqual(expected, result)
def test_regex_example_true2(self): #get the results of the function result = project.match("a.b.c", "abc") #the expected result expected = True self.assertEqual(expected, result)
import project #add the argument parser parser = argparse.ArgumentParser(add_help=False) #add the arguments to the parser parser.add_argument( "--instructions", help= "In order to run this program, please use the following command 'python3 project.py'. Then follow the instructions on the screen to test your regular expression" ) parser.add_argument( "--infix", required=True, help="This is the infix that will be compared to the string", type=str) parser.add_argument( "--string", required=True, help="This is the string that will be matched to the infix", type=str) parser.add_argument('-h', '--help', action='help', default=argparse.SUPPRESS, help='Default Help Message of Project Command line') args = parser.parse_args() #run the match function from the project class print(" Result:", project.match(str(args.infix), str(args.string)))
# Mateusz Pawlowski # Run a few regular expression import project print(project.match("a.b|b*", "bbbbbbbbbb"))