コード例 #1
0
    def test__exec_simple_search__term_not_in_file__return_empty(self):
        # Arrange
        path = self.txt_path
        content = self.txt_content
        term = "not-found"

        # Act
        result = FileInspector.exec_simple_search(path, content, term)

        # Assert
        self.assertEqual(list, type(result))
        self.assertEqual(0, len(result))
コード例 #2
0
    def test__exec_simple_search__term_has_line_break__return_file(self):
        # Arrange
        path = self.txt_path
        content = self.txt_content
        term = "elitr,\nsed"

        # Act
        result = FileInspector.exec_simple_search(path, content, term)

        # Assert
        self.assertEqual(list, type(result))
        self.assertEqual(1, len(result))
コード例 #3
0
    def test__exec_simple_search__term_in_file__return_file(self):
        # Arrange
        path = self.txt_path
        content = self.txt_content
        term = "sed"

        # Act
        result = FileInspector.exec_simple_search(path, content, term)

        # Assert
        self.assertEqual(list, type(result))
        self.assertEqual(1, len(result))
        self.assertEqual(path, result[0].file)
        self.assertEqual(term, result[0].term)
        self.assertIsNone(result[0].line_number)