Refactoring
This commit is contained in:
parent
33b484085f
commit
e612b52087
2 changed files with 6 additions and 6 deletions
|
@ -18,7 +18,7 @@ License.
|
||||||
import json
|
import json
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
from validator.residue_index import CheckResidueIndices
|
from validator.residue_index import ResidueIndexes
|
||||||
|
|
||||||
with open("data/test_data.json", "r") as mock_data_file:
|
with open("data/test_data.json", "r") as mock_data_file:
|
||||||
mock_data = json.load(mock_data_file)
|
mock_data = json.load(mock_data_file)
|
||||||
|
@ -46,7 +46,7 @@ def mock_compare_residue_number(self, foo, bar):
|
||||||
class TestCheckResidueIndices(TestCase):
|
class TestCheckResidueIndices(TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.cri = CheckResidueIndices(mock_data)
|
self.cri = ResidueIndexes(mock_data)
|
||||||
|
|
||||||
def test_loop_chains(self):
|
def test_loop_chains(self):
|
||||||
self.cri._get_residue_numbering = mock_get_residue_numbering_false
|
self.cri._get_residue_numbering = mock_get_residue_numbering_false
|
||||||
|
@ -60,7 +60,7 @@ class TestCheckResidueIndices(TestCase):
|
||||||
|
|
||||||
def test_set_pdb_id(self):
|
def test_set_pdb_id(self):
|
||||||
self.assertIsNotNone(self.cri._set_pdb_id())
|
self.assertIsNotNone(self.cri._set_pdb_id())
|
||||||
bad_cri = CheckResidueIndices(mock_data_no_pdb_id)
|
bad_cri = ResidueIndexes(mock_data_no_pdb_id)
|
||||||
self.assertIsNone(bad_cri._set_pdb_id())
|
self.assertIsNone(bad_cri._set_pdb_id())
|
||||||
|
|
||||||
def test_check_numbering(self):
|
def test_check_numbering(self):
|
||||||
|
@ -85,7 +85,7 @@ class TestCheckResidueIndices(TestCase):
|
||||||
self.assertFalse(result)
|
self.assertFalse(result)
|
||||||
|
|
||||||
def test_with_bad_numbering(self):
|
def test_with_bad_numbering(self):
|
||||||
cri_with_bad_numbering = CheckResidueIndices(mock_data_bad_numbering)
|
cri_with_bad_numbering = ResidueIndexes(mock_data_bad_numbering)
|
||||||
result = cri_with_bad_numbering.check_every_residue()
|
result = cri_with_bad_numbering.check_every_residue()
|
||||||
self.assertFalse(result)
|
self.assertFalse(result)
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ import json
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
|
||||||
class CheckResidueIndices(object):
|
class ResidueIndexes(object):
|
||||||
"""
|
"""
|
||||||
This class has all the methods required for validating the
|
This class has all the methods required for validating the
|
||||||
residue indices that are in the user submitted data.
|
residue indices that are in the user submitted data.
|
||||||
|
@ -29,7 +29,7 @@ class CheckResidueIndices(object):
|
||||||
indices
|
indices
|
||||||
|
|
||||||
Example usage:
|
Example usage:
|
||||||
check_indexes = CheckResidueIndices(your_json_object)
|
check_indexes = ResidueIndexes(your_json_object)
|
||||||
if check_indexes.check_every_residue():
|
if check_indexes.check_every_residue():
|
||||||
# all residues in every chain are correctly indexed
|
# all residues in every chain are correctly indexed
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue