-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactors to individual tests modules
- Loading branch information
1 parent
7b4ea76
commit 34ec5e2
Showing
10 changed files
with
198 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
''' | ||
Created on 2021-07-16 | ||
@author: wf | ||
''' | ||
import unittest | ||
|
||
|
||
class TestIssue153AcceptanceRate(unittest.TestCase): | ||
|
||
|
||
def setUp(self): | ||
pass | ||
|
||
|
||
def tearDown(self): | ||
pass | ||
|
||
|
||
def testIssue152(self): | ||
''' | ||
test for fixing Acceptance Rate Not calculated | ||
https://github.com/SmartDataAnalytics/OpenResearch/issues/152 | ||
''' | ||
eventRecords= [{'submittedPapers':'test', 'acceptedPapers':'test'}, | ||
{'submittedPapers': None, 'acceptedPapers':None}, | ||
{'submittedPapers':'test', 'acceptedPapers':None}, | ||
{'submittedPapers':None, 'acceptedPapers':'test'}] | ||
painRatings=[] | ||
fixer=self.getAcceptanceRateFixer() | ||
for event in eventRecords: | ||
painRating =fixer.getRating(event) | ||
self.assertIsNotNone(painRating) | ||
painRatings.append(painRating.pain) | ||
self.assertEqual(painRatings,[1,3,5,7]) | ||
pages=fixer.getAllPages() | ||
if self.debug: | ||
print("Number of pages: ", len(pages)) | ||
expectedPages=0 if hf.inPublicCI() else 8000 | ||
self.assertTrue(len(pages)>=expectedPages) | ||
events=list(fixer.getAllPageTitles4Topic("Event")) | ||
expectedEvents=0 if hf.inPublicCI() else 5500 | ||
if self.debug: | ||
print("Number of events: ", len(events)) | ||
self.assertTrue(len(events)>=expectedEvents) | ||
fixer.checkAllFiles(fixer.check) | ||
if self.debug: | ||
print(fixer.result()) | ||
print(expectedEvents) | ||
self.assertTrue(fixer.nosub>=0 if hf.inPublicCI() else 50) | ||
self.assertTrue(fixer.nosub>=0 if hf.inPublicCI() else 50) | ||
|
||
|
||
if __name__ == "__main__": | ||
#import sys;sys.argv = ['', 'Test.testName'] | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
''' | ||
Created on 2021-07-16 | ||
@author: wf | ||
''' | ||
import unittest | ||
|
||
|
||
class TestIssue163(unittest.TestCase): | ||
''' | ||
''' | ||
|
||
def setUp(self): | ||
pass | ||
|
||
|
||
def tearDown(self): | ||
pass | ||
|
||
|
||
def testIssue163(self): | ||
''' | ||
Series Fixer | ||
''' | ||
#self.debug=True | ||
eventRecords = [{'inEventSeries': '3DUI', 'has Bibliography': 'test'}, | ||
{'inEventSeries': ['test','test2'], 'endDate': '20 Feb, 2020'}, | ||
{'Ordinal': 2}, | ||
] | ||
expectedPainRatings=[1, 9, 7] | ||
fixer=self.getSeriesFixer() | ||
painRatings=[] | ||
for eventRecord in eventRecords: | ||
painRating=fixer.getRating(eventRecord) | ||
painRatings.append(painRating.pain) | ||
self.assertEqual(expectedPainRatings, painRatings) | ||
askExtra="" if hf.inPublicCI() else "[[Creation date::>2018]][[Creation date::<2020]]" | ||
count=fixer.checkAll(askExtra) | ||
# TODO: we do not test the count here - later we want it to be zero | ||
# TODO: Records obtained with fromWiki already filter the list | ||
|
||
|
||
if __name__ == "__main__": | ||
#import sys;sys.argv = ['', 'Test.testName'] | ||
unittest.main() |
Oops, something went wrong.