def test_false_on_y_gap(self):
     xml_data = []
     xml_data.append(XMLData(" ", 10.0, 10.0, "Font", 24.0, False, True))
     xml_data.append(XMLData("b", 10.0, 100.0, "Font", 24.0, False, True))
     expected_result = 1
     actual_result = PerthExtractor.check_for_repeated_phrases(
         self, xml_data, 0)
     self.assertTrue(expected_result == actual_result)
 def test_repeated_xml_none(self):
     captured_output = io.StringIO()
     sys.stdout = captured_output
     xml_data = None
     expected_result = 0.0
     actual_result = PerthExtractor.check_for_repeated_phrases(
         self, xml_data, 0)
     sys.stdout = sys.__stdout__
     self.assertTrue(expected_result == actual_result)
    def test_reach_list_end_immediately(self):
        xml_data = []
        xml_data.append(self.xml_data_space)

        expected_result = 1
        actual_result = PerthExtractor.check_for_repeated_phrases(
            self, xml_data, 1)

        self.assertTrue(expected_result == actual_result)
    def test_immediate_different_line(self):
        xml_data = []
        xml_data.append(self.xml_data_y_1)
        xml_data.append(self.xml_data_space)

        expected_result = 1.0
        actual_result = PerthExtractor.check_for_repeated_phrases(
            self, xml_data, 0)

        self.assertTrue(expected_result == actual_result)
    def test_removed_character(self):
        xml_data = []
        xml_data.append(self.xml_data_y_1)
        xml_data.append(self.xml_data_y_2)
        xml_data.append(self.xml_data_y_3)

        expected_result = 2.0
        actual_result = PerthExtractor.check_for_repeated_phrases(
            self, xml_data, 0)

        self.assertTrue(expected_result == actual_result)
    def test_double_loop(self):
        xml_data = []
        xml_data.append(self.xml_data_y_1)
        xml_data.append(self.xml_data_y_1)
        xml_data.append(self.xml_data_y_1)
        xml_data.append(self.xml_data_space)

        expected_result = 3.0
        actual_result = PerthExtractor.check_for_repeated_phrases(
            self, xml_data, 0)

        self.assertTrue(expected_result == actual_result)
 def test_xml_empty(self):
     xml_data = []
     expected_result = 0.0
     actual_result = PerthExtractor.check_for_repeated_phrases(
         self, xml_data, 0)
     self.assertTrue(expected_result == actual_result)