Skip to content

Commit

Permalink
added Paper test and fixed Paper bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Mcilie committed Oct 31, 2023
1 parent efbbdd5 commit af9e93a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/prompt_systematic_review/paperSource.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ def __init__(self, title: str, firstAuthor: str, url: str, dateSubmitted: date,
self.firstAuthor = firstAuthor
self.url = url
self.dateSubmitted = dateSubmitted
self.keywords = keywords
self.keywords = keyWords
try:
assert set(keywords) == set([k.lower() for k in keyWords])
assert set(keyWords) == set([k.lower() for k in keyWords])
except:
raise ValueError("Keywords must be lowercase")

Expand Down
11 changes: 11 additions & 0 deletions tests/test_paper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import pytest
from prompt_systematic_review.paperSource import Paper
from datetime import date

def test_paper():
paper1 = Paper("How to write a paper", "Harry Parnasus", "example.com", date(2000,2,2), ["keyword1", "keyword2"])
paper2 = Paper("How to NOT write a paper", "John Dickenson", "example.com", date(2002,3,3), ["keyword1", "keyword2"])
alsoPaper1 = Paper("How to write a paper", "Dr. Harry Parnasus", "https://example2.com", date(2000,2,5), ["keyword1", "keyword2"])

assert paper1 == alsoPaper1
assert paper1 != paper2 and paper2 != alsoPaper1

0 comments on commit af9e93a

Please sign in to comment.