def main():

    # parse the information and loads it into datastructure
    graph = parse(0)
    parse_scraped(graph)

    # connect to the DB
    # write to the DB
    Database.create()

    Database.insert(graph)

    print("Welcome to our second sprint project")
    quit_shell = False

    while quit_shell is False:
        print(
            'Please input the section abbrevation (e.g. CIS) to create the .gefx file (enter blank for all courses) or type \"quit\" or \"exit\" to exit: '
        )

        user_input = input("> ")
        user_input = user_input.lower().strip()
        if user_input == "quit" or user_input == "exit":
            # user exits
            quit_shell = True
        else:
            Graph.to_gefx(graph, user_input)
            # user exits
            quit_shell = True
Beispiel #2
0
 def test_spit_CIS(self):
   g = parse(0)
   Graph.to_gefx(g, "CIS")
   f = open('testSize.gexf', 'r')
   for line in f:
     result = re.findall("!(CIS)*[0-9]+",line)
   f.close()
   self.assertEqual(result, [])
 def test_case_desc(self):
     g = parse(0)
     ret = search.search(
         search.parse_user_input(
             "Show me all courses about \"scottish\" things"), g)
     self.assertTrue(ret is not None)
     self.assertEqual(len(ret), 2)
     for i in ret:
         self.assertTrue("Scottish" in i.description)
 def test_case_lab(self):
     g = parse(0)
     ret = search.search(
         search.parse_user_input(
             "Show me all \"cis\" courses with 3 lab hours"), g)
     self.assertTrue(ret is not None)
     self.assertEqual(len(ret), 39)
     for i in ret:
         self.assertTrue("3" in i.lab_hours)
     for i in ret:
         self.assertTrue("CIS" in i.course_code)
 def test_case_sem_lec(self):
     g = parse(0)
     ret = search.search(
         search.parse_user_input(
             "Show me a fall offering with 3 lecture hours"), g)
     self.assertTrue(ret is not None)
     self.assertEqual(len(ret), 80)
     for i in ret:
         self.assertTrue("F" in i.semesters_offered)
     for i in ret:
         self.assertTrue("3" in i.lecture_hours)
 def test_case_search_title_code(self):
     g = parse(0)
     ret = search.search(
         search.parse_user_input(
             "Course title \"Parallel Programming\" with the code cis*3090"
         ), g)
     self.assertTrue(ret is not None)
     self.assertEqual(len(ret), 1)
     for i in ret:
         self.assertTrue("Parallel Programming" in i.course_title)
     for i in ret:
         self.assertTrue("CIS*3090" in i.course_code)
Beispiel #7
0
def main():
    #run the scrape -- CURRENTLY BROKEN
    ##scrape.mainRunner()

    # parse the information and loads it into datastructure
    graph = parse(0)
    parse_scraped(graph)

    # Will update all rows based on the generated graph
    print("Updating Courses.....")
    Database.updateAll(graph)
    print("Finished updating Courses!")
 def test_case_search_sem_credit(self):
     g = parse(0)
     expected = '{"course_title": "User Interface Design", "course_code": "CIS*2170", "semesters_offered": ["W"], "lecture_hours": "2", "lab_hours": "3", "credit_weight": "[0.75]", "description": " This course is a practical introduction to the area of user interface construction. Topics include user interface components and their application, best practices for user interface design, approaches to prototyping, and techniques for assessing interface suitability. "}'
     ret = search.search(
         search.parse_user_input(
             "Show me all courses with \"cis\" courses with 0.75 credits"),
         g)
     self.assertTrue(ret is not None)
     self.assertEqual(len(ret), 4)
     for i in ret:
         self.assertTrue("CIS" in i.course_code)
     for i in ret:
         self.assertTrue("[0.75]" in i.credit_weight)
def main():

    print("\n********************************************Test Case 1********************************************\n")
    print("\t Check if gexf file is being created\n")

    # parse the information and loads it into datastructure
    graph = parse(0)

    Graph.to_gefx(graph, "")

    print ("\t File exists:"+str(path.exists('testSize.gexf')))


    print("\n********************************************Test Case 2********************************************\n")
    print("\t Check if node element has size attribute\n")

    # parse the information and loads it into datastructure
    
    root = ET.parse("testSize.gexf") 

    size = root.find("node[@id='MCS*4100']/{http://www.gexf.new/1.3/viz}size")

    if size != None:
        print("\t success")
    else:
        print("\t fail")


    
    ## TO DO
    print("\n********************************************Test Case 3********************************************\n")
    print("\t Check if node element has colour attribute\n")

    # parse the information and loads it into datastructure
    root = ET.parse("testSize.gexf")
    
    color = root.find("node[@id='MCS*4100']/{http://www.gexf.new/1.3/viz}color")

    if color != None:
        print("\t success")
    else:
        print("\t fail")
def main():

    # parse the information and loads it into datastructure
    graph = parse(0)

    print("Welcome to our first sprint project")
    quit_shell = False

    while quit_shell is False:
        print('Please select your option by typing the coresponding number or type \"quit\" or \"exit\" to exit: ')
        print("1: Enter in your own search query")
        print("2: Select from a list of pre built queries")

        user_input = input("> ")
        user_input = user_input.lower()
        if user_input == "quit" or user_input == "exit":
            # user exits
            quit_shell = True
        elif user_input == "1":

            print(" please enter your search query, (e.g \" Show me all 0.25 credit courses \"): ")

            user_input = input("> ")
            user_input = user_input.lower()

            # user inputs search option
            # parse user input
            user_input = search.parse_user_input(user_input)

            # searches datastructure for results
            search_result = search.search(user_input, graph)
            
            print("***TEST***")
            print(user_input)
            
            # prints out the result's
            print_data(search_result)


        elif user_input == "2":
            # user selects a pre built query
            print("Please select from our pre-build queries by typing the coresponding number: ")

            search_result = search.canned_search(graph)

            print_data(search_result)

            # print("1: ")
            # print("2: ")
            # print("3: ")
            # print("4: ")
            # print("5: ")

            # user_selection = input("> ")
            # if user_selection ==1:
            #     print("1: ")
            # elif user_selection == 2:
            #     print("2: ")
            # elif user_selection == 3:
            #     print("3: ")
            # elif user_selection == 4:
            #     print("4: ")
            # elif user_selection == 5:
            #     print("5: ")
            # else:
            #     print("sorry you did not enter a valid option, returning to main menu")
                
        else:
            print("That is not a valid option please try again")
Beispiel #11
0
from course_parse import parse
from course_parse import course_obj

obj_list = parse(1)
count = 0

print(
    "\n********************************************Test Case 1********************************************\n"
)
print("\t Check Human Resources and Orgnizational Behaviour (courses)\n")
for element in obj_list:
    if "HROB" in element.course_code:
        count += 1

if count == 15:
    print("Excepting: 15    Result: 15    PASS\n\n")
else:
    print("Excepting: 15    Result: " + str(count) + "    FAIL\n\n")

count = 0
print(
    "********************************************Test Case 2********************************************\n"
)
print("\t Check Computing and Information Science (courses)\n")
for element in obj_list:
    if "CIS" in element.course_code:
        count += 1

if count == 48:
    print("Excepting: 48    Result: 48    PASS\n\n")
else: