def showDialog(self):
        self.tableWidget.clearContents()
        self.tableWidget.setRowCount(0)

        default_dir = str(
            pathlib.Path.home()
        ) if self.reading_list_directory is None else self.reading_list_directory
        reading_list = QtWidgets.QFileDialog.getOpenFileName(
            self, 'Open file', default_dir)

        if (reading_list[0].split('.')[-1] == 'doc'):
            popup = QtWidgets.QMessageBox()
            popup.setText('Error: doc file not supported')
            popup.setInformativeText(
                'Please convert the doc file to docx or pdf.')
            popup.exec_()
            return

        # with the case names, construct the table
        if reading_list[0]:
            self.citation_list = parsedocs.start_extract(
                reading_list[0], self.stared_only)

            for row_num, case_title in enumerate(self.citation_list):
                self.construct_table_row_from_list(row_num, case_title)

            reading_list_directory = str(pathlib.Path(reading_list[0]).parent)
            self.save_reading_list_directory(reading_list_directory)
def test_extract_correct_number_stared_cases(test_case, expected_output):
    test_case_path = os.path.join(os.getcwd(), TEST_DIR, test_case)
    citation_list = parsedocs.start_extract(test_case_path, stared=True)
    expected_citation_list = load_expected_citation_list(expected_output)

    num_citation = len(citation_list)
    num_expected_citation = len(expected_citation_list)
    assert num_citation == num_expected_citation, "Expected {} cases, but found {} cases".format(
        num_expected_citation, num_citation)
def test_extract_correct_stared_case_citations(test_case, expected_output):
    test_case_path = os.path.join(os.getcwd(), TEST_DIR, test_case)
    citation_list = set(parsedocs.start_extract(test_case_path, stared=True))
    expected_citation_list = load_expected_citation_list(expected_output)

    assert citation_list == expected_citation_list