def test_12(self): # Arrange test = ClassFinder() with open("test4.txt") as file: test_data = file.read() # Act test.find_class(test_data) # Assert self.assertEqual(test.my_classes.__len__(), 8)
def test_14(self): # Arrange test = ClassFinder() with open("test4.txt") as file: test_data = file.read() # Act test.find_class(test_data) last_class = test.my_classes[-1].class_name # Assert self.assertEqual(last_class, "CommandLineInterpreter")
def test_13(self): # Arrange test = ClassFinder() with open("test4.txt") as file: test_data = file.read() # Act test.find_class(test_data) first_class = test.my_classes[0].class_name # Assert self.assertEqual(first_class, "Controller")
def test_11(self): # Arrange test = ClassFinder() with open("test4.txt") as file: test_data = file.read() # Act test.find_class(test_data) # Assert self.assertGreater(test.my_classes.__len__(), 0, "my_classes List should not be empty")
def test_16(self): # Arrange test = ClassFinder() with open("test4.txt") as file: test_data = file.read() # Act test.find_class(test_data) last_class_attributes = test.my_classes[-1].attribute # Assert self.assertEqual(last_class_attributes, [ 'prompt : String', 'my_controller : controller', 'banner : string' ])
def test_15(self): # Arrange test = ClassFinder() with open("test4.txt") as file: test_data = file.read() # Act test.find_class(test_data) first_class_attributes = test.my_classes[0].attribute # Assert self.assertEqual(first_class_attributes, [ 'my_command_line_interpreter : CommandLineInterpreter', 'data : None', 'pep8_content : None', 'my_class_finder : class_finder', 'my_view : view', 'all_my_classes : list' ])
def test_18(self): # Arrange test = ClassFinder() with open("test4.txt") as file: test_data = file.read() # Act test.find_class(test_data) last_class_methods = test.my_classes[-1].method # Assert self.assertEqual(last_class_methods, [ ' __init__(self, controller: Controller): None', ' do_load_self(self, path: String): None', ' do_write_file(self, path: String): None', 'help_print_file(self): None', 'help_write_file(self): None', 'help_load_file(self): None', 'help_quit(self): None', 'help_greet(self): None', ' do_greet(self, line: None): None', ' do_print_file(self, line: None): None', ' do_quit(self, line: None): None' ])
def test_17(self): # Arrange test = ClassFinder() with open("test4.txt") as file: test_data = file.read() # Act test.find_class(test_data) first_class_methods = test.my_classes[0].method # Assert self.assertEqual(first_class_methods, [ " __init__(self, class_finder: ClassFinder, view: View): None", "start_menu(self): None", "find_all(self): None", " write_all(self, directory_name: String): None", "command_line_interpreter(self): None", " read_file_from_path(self, path: String): None", " write_file_to_path(self, path: String): None", "print_file_to_interpreter(self): String", "prep_pep8(self): None", "get_class_names(self): List" ])
def test_19(self): # Arrange test = ClassFinder() with open("test4.txt") as file: test_data = file.read() # Act test.find_class(test_data) test.relationship_finder(test_data) class_relationship = test.my_classes[0].relationship # Assert self.assertEqual(class_relationship, [ "-- ClassFinder", "-- FileHandler", "-- PEP8Converter", "-- View" ])
def start_cmd(): if __name__ == "__main__": view = ConsoleView() class_finder = ClassFinder() controller = InterpreterController(class_finder, view) controller.start_menu()