Exemple #1
0
 def helper():
     input_type = InputType.FileReadInput
     file_path = "tests//resources//test_file.txt"
     file_input = create_input(input_type)
     file_input.add_file_path(file_path)
     file_input.get_houses()
     raise TestError
Exemple #2
0
    def test_get_houses_1(self):
        # Arrange
        input_type = InputType.StringInput
        string = "text"

        # Act & Assert
        string_input = create_input(input_type)
        string_input.add_string(string)
        self.assertRaises(BadInputFormatError, string_input.get_houses)
Exemple #3
0
    def test_create_input_1(self):
        # Arrange
        input_type = InputType.FileReadInput

        # Act
        file_input = create_input(input_type)

        # Assert
        self.assertIsInstance(file_input, FileReadInput)
Exemple #4
0
    def test_get_houses_2(self):
        # Arrange
        input_type = InputType.StringInput
        string = "5x5 (6, 1)"

        # Act & Assert
        string_input = create_input(input_type)
        string_input.add_string(string)
        self.assertRaises(BadHouseCoordinatesError, string_input.get_houses)
Exemple #5
0
    def test_FileReadInput_1(self):
        # Arrange
        input_type = InputType.FileReadInput
        file_path = "text"

        # Act
        file_input = create_input(input_type)
        file_input.add_file_path(file_path)

        # Assert
        self.assertEqual(file_input.file_path, file_path)
Exemple #6
0
    def test_StringInput_1(self):
        # Arrange
        input_type = InputType.StringInput
        string = "text"

        # Act
        string_input = create_input(input_type)
        string_input.add_string(string)

        # Assert
        self.assertEqual(string_input.string, string)
Exemple #7
0
    def test_get_text_instructions_1(self):
        # Arrange
        string = "3x3 (1, 2)"
        string_input = create_input(InputType.StringInput)
        string_input.add_string(string)
        bot = Bot(string_input)

        # Act
        text_instructions = bot.get_text_instructions()

        # Assert
        self.assertEqual(text_instructions, "ENND")
Exemple #8
0
    def test_get_text_instructions_4(self):
        # Arrange
        file_path = "tests//resources//test_file.txt"
        file_input = create_input(InputType.FileReadInput)
        file_input.add_file_path(file_path)
        bot = Bot(file_input)

        # Act
        text_instructions = bot.get_text_instructions()

        # Assert
        self.assertEqual(text_instructions, "ENNNDEEEND")
Exemple #9
0
    def test_get_text_instructions_3(self):
        # Arrange
        string = "5x5 (0, 0) (1, 3) (4, 4) (4, 2) (4, 2) (0, 1) (3, 2) (2, 3) (4, 1)"
        string_input = create_input(InputType.StringInput)
        string_input.add_string(string)
        bot = Bot(string_input)

        # Act
        text_instructions = bot.get_text_instructions()

        # Assert
        self.assertEqual(text_instructions, "DNDENNDEDESDEDDSDNNND")
Exemple #10
0
    def test_get_houses_3(self):
        # Arrange
        input_type = InputType.StringInput
        string = "5x5 (3, 2)"

        # Act
        string_input = create_input(input_type)
        string_input.add_string(string)
        houses = string_input.get_houses()

        # Assert
        self.assertEqual(houses[0].X, 3)
        self.assertEqual(houses[0].Y, 2)
Exemple #11
0
    def test_get_houses_4(self):
        # Arrange
        input_type = InputType.FileReadInput
        file_path = "tests//resources//test_file.txt"

        # Act
        file_input = create_input(input_type)
        file_input.add_file_path(file_path)
        houses = file_input.get_houses()

        # Assert
        self.assertEqual(len(houses), 2)
        self.assertEqual(houses[0].X, 1)
        self.assertEqual(houses[0].Y, 3)
        self.assertEqual(houses[1].X, 4)
        self.assertEqual(houses[1].Y, 4)
Exemple #12
0
 def helper():
     input_type = InputType.FileReadInput
     file_path = "something random"
     file_input = create_input(input_type)
     file_input.add_file_path(file_path)
     file_input.get_houses()
Exemple #13
0
 def helper():
     input_type = InputType.FileReadInput
     file_input = create_input(input_type)
     file_input.get_houses()
Exemple #14
0
 def helper():
     input_type = InputType.StringInput
     string_input = create_input(input_type)
     string_input.get_houses()
Exemple #15
0
 def helper():
     input_type = "something random"
     random_input = create_input(input_type)
Exemple #16
0
def run() -> None:
    """Method used to run the pizzabot using CLI"""
    cli_input = create_input(InputType.SysArgvInput)
    bot = Bot(cli_input)
    text_instructions = bot.get_text_instructions()
    print(text_instructions)