-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge tests #21
Merged
Merged
Merge tests #21
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
6ef3ea6
ensure files close in useful_functions
Islast 3f1bd30
progress testing
Islast e3eb1f3
Delete fixtest.py
Islast 458ebcc
Delete testing.py
Islast 5b340e4
Delete simpletest.py
Islast 442f2d2
Delete corrmat_picture_LowRes.png
Islast 78dc97a
Delete corrmat_picture.png
Islast cad1031
Delete Untitled Document 1
Islast 149dd21
Delete corrmat_file.txt
Islast 06d8bef
tidy folders
Islast 7138d2a
fix regression testing
Islast 75078d7
delete broken notebook
Islast 7a173d2
delete lint
Islast 32bb840
delete lint
Islast d5f33e0
edit tests to allow tests to run from top directory
Islast 5451b40
delete lint
Islast 0d97f26
Change write_fixtures to contain overwrite_fixtures function as an op…
Islast e49c880
rename Regression_tests.py to regression_tests.py
Islast f53a735
add documentation to regression tests
Islast 1cd2431
restore notebook from upstream master branch
Islast c98121c
add missing '#' to write_fixtures.py
Islast File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Empty file.
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,61 @@ | ||
import unittest | ||
import filecmp | ||
import os | ||
|
||
class FixturesTest(unittest.TestCase): | ||
|
||
#------------------- setup and teardown --------------------------- | ||
@classmethod | ||
def setUpClass(cls): | ||
print('\nin set up - this takes about 80 secs') | ||
# We should have fixtures (generated by write_fixtures) saved | ||
# in TESTS/test_fixtures. To set up we run write_fixtures again | ||
# to generate new files in a temporary (/tmp) folder. | ||
# Later we will test that these files are identical to the old | ||
# ones | ||
from write_fixtures import write_fixtures | ||
write_fixtures('/tmp') | ||
# define paths to individual files for checking, relative to | ||
# the folder write_fixtures has saved in | ||
cls.corrmat = '/corrmat_file.txt' | ||
cls.gm = '/network-analysis/GlobalMeasures_corrmat_file_COST010.csv' | ||
cls.lm = '/network-analysis/NodalMeasures_corrmat_file_COST010.csv' | ||
cls.rich = '/network-analysis/RICH_CLUB_corrmat_file_COST010.csv' | ||
|
||
@classmethod | ||
def tearDownClass(cls): | ||
import shutil | ||
print('\nin tear down - deleting files') | ||
# delete all files generated in setup | ||
shutil.rmtree(os.getcwd()+'/tmp') | ||
|
||
#--------------------------- Tests -------------------------------- | ||
# Each of these tests checks that ourly newly generated version of | ||
# file_x matches the fixture version | ||
|
||
def test_corrmat_matches_fixture(self): | ||
# test new correlation matrix against fixture | ||
print('\ntesting new correlation matrix against fixture') | ||
self.assertTrue(filecmp.cmp(os.getcwd()+'/tmp'+self.corrmat, | ||
os.getcwd()+'/TESTS/test_fixtures'+self.corrmat)) | ||
|
||
def test_gm_against_fixture(self): | ||
# test new global measures against fixture | ||
print('\ntesting new global measures against fixture') | ||
self.assertTrue(filecmp.cmp(os.getcwd()+'/tmp'+self.gm, | ||
os.getcwd()+'/TESTS/test_fixtures'+self.gm)) | ||
|
||
def test_lm_against_fixture(self): | ||
# test new local measures against fixture | ||
print('\ntesting new local measures against fixture') | ||
self.assertTrue(filecmp.cmp(os.getcwd()+'/tmp'+self.lm, | ||
os.getcwd()+'/TESTS/test_fixtures'+self.lm)) | ||
|
||
def test_rich_against_fixture(self): | ||
# test rich club against fixture | ||
print('\ntesting rich club against fixture') | ||
self.assertTrue(filecmp.cmp(os.getcwd()+'/tmp'+self.rich, | ||
os.getcwd()+'/TESTS/test_fixtures'+self.rich)) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions
11
TESTS/test_fixtures/network-analysis/GlobalMeasures_corrmat_file_COST010.csv
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,11 @@ | ||
,C,C_rand,E,E_rand,L,L_rand,M,M_rand,a,a_rand,sigma,sigma_rand | ||
0,0.44501157500471683,0.2396872949320527,0.4304588561073706,0.48411062496129836,2.3985363171030922,2.0993273827150047,0.39148198969632453,0.1249772927086647,0.09839954481630904,-0.0700837697837918,1.6250254433756204,1.0 | ||
1,0.44501157500471683,0.2174227562868005,0.4304588561073706,0.4847265379086393,2.3985363171030922,2.095731629933584,0.39148198969632453,0.12731870848392296,0.09839954481630904,-0.07679807569425844,1.788363015246689,1.0 | ||
2,0.44501157500471683,0.22092106802269246,0.4304588561073706,0.48403281395004144,2.3985363171030922,2.0997927154278946,0.39148198969632453,0.13036605163106316,0.09839954481630904,-0.08266456062740023,1.7634546652489054,1.0 | ||
3,0.44501157500471683,0.21856495556002697,0.4304588561073706,0.48340967256640077,2.3985363171030922,2.1020982275053934,0.39148198969632453,0.12549473019465238,0.09839954481630904,-0.05266971271118482,1.7844216581434573,1.0 | ||
4,0.44501157500471683,0.2276831828667354,0.4304588561073706,0.4838304070463133,2.3985363171030922,2.1006599263928254,0.39148198969632453,0.13131361885790951,0.09839954481630904,-0.07657874897168201,1.7117873214190515,1.0 | ||
5,0.44501157500471683,0.22756787299188863,0.4304588561073706,0.4854780925985942,2.3985363171030922,2.092368543508609,0.39148198969632453,0.12797845829875495,0.09839954481630904,-0.09161575675817406,1.7058947815404288,1.0 | ||
6,0.44501157500471683,0.21978595203448484,0.4304588561073706,0.484643545098188,2.3985363171030922,2.0962604171073225,0.39148198969632453,0.13341693967455034,0.09839954481630904,-0.07528298446703349,1.7695804520474392,1.0 | ||
7,0.44501157500471683,0.22130242377743747,0.4304588561073706,0.4835040403042075,2.3985363171030922,2.1023308938618386,0.39148198969632453,0.13050373916136204,0.09839954481630904,-0.0667199522043918,1.7625437689454024,1.0 | ||
8,0.44501157500471683,0.21647140482862245,0.4304588561073706,0.48430800311722366,2.3985363171030922,2.0987139895934686,0.39148198969632453,0.12302424263054784,0.09839954481630904,-0.08673604011831655,1.7987786763522513,1.0 | ||
9,0.44501157500471683,0.22394406446908866,0.4304588561073706,0.48465418183949754,2.3985363171030922,2.0961335081856256,0.39148198969632453,0.128253340360523,0.09839954481630904,-0.07014799252576139,1.7366183795743748,1.0 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! Well caught 🙌