Skip to content

Commit

Permalink
Add test for matching/pricessing a pubmed abstracts file without a le…
Browse files Browse the repository at this point in the history
…ading blank line
  • Loading branch information
asset-web committed Jan 10, 2024
1 parent 375646d commit 7424cd5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
File renamed without changes.
16 changes: 15 additions & 1 deletion tests/test_searching.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
from browser.models import SearchCriteria, SearchResult, MeshTerm, Upload, OVID, PUBMED, Gene

from tests.base_test_case import BaseTestCase
from tests.test_uploads import TEST_PUBMED_WITHOUT_BLANK_LINE

logger = logging.getLogger(__name__)
BASE_DIR = os.path.dirname(__file__)
Expand All @@ -75,6 +76,7 @@
TEST_FILE = os.path.join(BASE_DIR, 'test-abstract.txt')
TEST_PUBMED_MEDLINE_ABSTRACTS = os.path.join(BASE_DIR, 'pubmed_result_100.txt')
TEST_OVID_MEDLINE_ABSTRACTS = os.path.join(BASE_DIR, 'ovid_result_100.txt')
TEST_PUBMED_WITHOUT_BLANK_LINE = os.path.join(BASE_DIR, 'test_pubmed_wihout_leading_blank_line.txt')

#Invalid file uploads
TEST_NO_MESH_SUBJECT_HEADINGS_FILE = os.path.join(BASE_DIR, 'no-mesh-terms-abstract.txt')
Expand Down Expand Up @@ -953,4 +955,16 @@ def test_highlighting_matching_changes(self):
# Test the change is highlighted on the individual results pages
path = reverse('results', kwargs={'pk': search_result.id})
expected_text = ["Download version 1 scores (CSV)", "Download version 1 mechanism abstract IDs (CSV)", "Revised results", "Download version 3 mechanism abstract IDs (CSV)"]
self._find_expected_content(path=path, msg_list=expected_text)
self._find_expected_content(path=path, msg_list=expected_text)

def test_pubmed_search_without_intial_header_line(self):
"""Test workaround for bug #TMMA-496"""
self._login_user()
self._find_expected_content(path=reverse('search'),
msg="Upload abstracts to search")
self._find_expected_content(path=reverse("search_pubmed"),
msg=u"Search PubMed MEDLINE® formatted abstracts")
# Search PubMed formatted abstracts
self._test_search_bulk_term_edit(abstract_file_path=TEST_PUBMED_WITHOUT_BLANK_LINE,
file_format=PUBMED,
search_url=reverse('search_pubmed'))
2 changes: 1 addition & 1 deletion tests/test_uploads.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
TEST_BZ_OVID_ARCHIVE = os.path.join(BASE_DIR, 'ovid_result_100.txt.bz2')
TEST_GZIP_OVID_ARCHIVE = os.path.join(BASE_DIR, 'ovid_result_100.txt.gz')

TEST_PUBMED_WITHOUT_BLANK_LINE = os.path.join(BASE_DIR, 'test_pubmed_temmpo.txt')
TEST_PUBMED_WITHOUT_BLANK_LINE = os.path.join(BASE_DIR, 'test_pubmed_wihout_leading_blank_line.txt')

#Invalid file uploads
TEST_NO_MESH_SUBJECT_HEADINGS_FILE = os.path.join(BASE_DIR, 'no-mesh-terms-abstract.txt')
Expand Down

0 comments on commit 7424cd5

Please sign in to comment.