-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
11d62c5
commit 26777b2
Showing
5 changed files
with
3 additions
and
56 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
__author__ = 'Tongzhou Xu' | ||
__email__ = '[email protected]' | ||
__version__ = '0.9.32' | ||
__version__ = '0.9.4' |
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
import sqlite3 | ||
import shutil | ||
|
||
from unittest.mock import MagicMock, patch | ||
from mashpit.build import create_connection | ||
from mashpit.build import create_database | ||
from mashpit.build import download_metadata | ||
|
@@ -156,49 +157,5 @@ def test_compare_tables(self): | |
self.assertEqual(pds_to_add, ['PDS_002', 'PDS_004']) | ||
self.assertEqual(asm_acc_add, ['asm2', 'asm4']) | ||
|
||
class TestBuildAccession(unittest.TestCase): | ||
def setUp(self): | ||
class Args: | ||
def __init__(self): | ||
self.type = 'accession' | ||
self.name = 'test_database' | ||
self.quiet = True | ||
self.number = 1000 | ||
self.ksize = 31 | ||
self.email = '[email protected]' | ||
self.list = 'test_list' | ||
self.key = None | ||
self.args = Args() | ||
def tearDown(self): | ||
shutil.rmtree('test_database') | ||
def test_build_accession(self): | ||
build_accession(self.args) | ||
self.assertTrue(os.path.isfile('test_database/test_database.db')) | ||
self.assertTrue(os.path.isfile('test_database/test_database.sig')) | ||
# check the database structure | ||
conn = sqlite3.connect('test_database/test_database.db') | ||
c = conn.cursor() | ||
# check the number if lines in the METADATA table | ||
c.execute("SELECT COUNT(*) FROM METADATA;") | ||
result = c.fetchone() | ||
self.assertEqual(result[0], 3) | ||
c.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='DESC';") | ||
result = c.fetchone() | ||
self.assertIsNotNone(result) | ||
c.execute("PRAGMA table_info(METADATA);") | ||
columns = [row[1] for row in c.fetchall()] | ||
expected_columns = [ | ||
'biosample_acc', 'taxid', 'strain', 'collected_by', 'collection_date', 'geo_loc_name', | ||
'isolation_source', 'lat_lon', 'serovar', 'sub_species', 'species', 'genus', 'host', | ||
'host_disease', 'outbreak', 'srr', 'PDT_acc', 'PDS_acc', 'asm_acc' | ||
] | ||
self.assertListEqual(columns, expected_columns) | ||
c.execute("PRAGMA table_info(DESC);") | ||
columns = [row[1] for row in c.fetchall()] | ||
expected_columns = ['name', 'value'] | ||
self.assertListEqual(columns, expected_columns) | ||
conn.close() | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
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 |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
|
||
setup( | ||
name='mashpit', | ||
version='0.9.32', | ||
version='0.9.4', | ||
url='https://github.com/tongzhouxu/mashpit', | ||
author='Tongzhou Xu', | ||
author_email='[email protected]', | ||
|