-
Notifications
You must be signed in to change notification settings - Fork 49
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
Issue #26 test cases and uri code updated #31
Changes from 7 commits
33920be
c5c29c4
b7be4d4
a21b62d
7d9db56
f781f1d
952a5c5
a26a89a
ec87aaa
66e2215
783e017
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
"""Tests for sradb.py | ||
""" | ||
|
||
import os | ||
import pytest | ||
from pysradb import SRAdb | ||
from pysradb.filter_attrs import guess_cell_type, guess_tissue_type, guess_strain_type | ||
from sqlite3 import OperationalError | ||
|
||
def test_not_valid_file(): | ||
"""Test to check for error if file is either not | ||
present or not a valid sqlite file""" | ||
path = 'SRAmetadb.sqlite' | ||
try: | ||
db = SRAdb(path) | ||
assert False | ||
except SystemExit: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you help me understand which case would a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In case if a file does not exist, |
||
assert os.path.isfile(path) == False | ||
except OperationalError: | ||
assert True | ||
|
||
|
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.
Why
assert False
?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 because while testing,
SRAmetadb.sqlite
file won't exist in the current directory, hence if it succeeds in establishing a connection, then it would be wrong, hence the assert False.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.
Ummm, but an error would be raised before hand and hence this statement is practically unreachable?
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.
Yes, practically it shouldn't reach it.
This statement is just for edge case in case it makes a connection...
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.
I guess it should be removed then...
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.
Done, I've removed it in the latest commit.
But travis is failing to build even though pytest passes all checks. It may be because of the black --check statement.