def test_with_set_not_matching_set_number_regex(self, mock_pfunc, mock_parse_methyl_score, mock_parse_canflip_score, mock_parse_other_score): user_mod = ['Set blah:2:3:4'] with self.assertRaises(ValueError): flips.parse_flips(user_mod)
def test_unparseable_score(self, mock_pfunc, mock_parse_methyl_score, mock_parse_canflip_score, mock_parse_other_score): mock_pfunc.return_value = [1, 2, 3, 4, 5] user_mod = ['Single : A 89 SER OG : rot 180:bad score section'] with self.assertRaises(ValueError): flips.parse_flips(user_mod)
def test_user_mod_with_too_many_sections(self, mock_pfunc, mock_parse_methyl_score, mock_parse_canflip_score, mock_parse_other_score): user_mod = ['Set:2:3:4:5'] with self.assertRaises(ValueError): flips.parse_flips(user_mod)
def test_single_other_calls_parse_other_score(self, mock_pfunc, mock_parse_methyl_score, mock_parse_canflip_score, mock_parse_other_score): mock_pfunc.return_value = [1, 2, 3, 4, 5] mock_parse_other_score.return_value = [1, 2] user_mod = ['Single : A 89 SER OG : rot 180:sc= 0'] flips.parse_flips(user_mod) assert mock_parse_other_score.called
def test_single_canflip_calls_parse_canflip_score(self, mock_pfunc, mock_parse_methyl_score, mock_parse_canflip_score, mock_parse_other_score): mock_pfunc.return_value = [1, 2, 3, 4, 5] mock_parse_canflip_score.return_value = [1, 2, 3, 4, 5, 6, 7] user_mod = ['Single : A 41 ASN :FLIP amide:sc= -0.0583 X(o=-0.064,f=-0.058)'] flips.parse_flips(user_mod) assert mock_parse_canflip_score.called
def test_single_methyl_calls_parse_methyl_score(self, mock_pfunc, mock_parse_methyl_score, mock_parse_canflip_score, mock_parse_other_score): mock_pfunc.return_value = [1, 2, 3, 4, 5] mock_parse_methyl_score.return_value = [1, 2, 3, 4] user_mod = ['Single : A 57 LYS NZ :NH3+ 180:sc= 0 (180deg=0)'] flips.parse_flips(user_mod) assert mock_parse_methyl_score.called
def test_single_canflip_calls_parse_canflip_score(self, mock_pfunc, mock_parse_methyl_score, mock_parse_canflip_score, mock_parse_other_score): mock_pfunc.return_value = [1, 2, 3, 4, 5] mock_parse_canflip_score.return_value = [1, 2, 3, 4, 5, 6, 7] user_mod = [ 'Single : A 41 ASN :FLIP amide:sc= -0.0583 X(o=-0.064,f=-0.058)' ] flips.parse_flips(user_mod) assert mock_parse_canflip_score.called
def test_single_methyl_calls_parse_methyl_score(self, mock_pfunc, mock_parse_methyl_score, mock_parse_canflip_score, mock_parse_other_score): mock_pfunc.return_value = [1, 2, 3, 4, 5] mock_parse_methyl_score.return_value = [1, 2, 3, 4] user_mod = [ 'Single : A 57 LYS NZ :NH3+ 180:sc= 0 (180deg=0)' ] flips.parse_flips(user_mod) assert mock_parse_methyl_score.called
def test_calls_parse_func_group(self, mock_pfunc, mock_parse_methyl_score, mock_parse_canflip_score, mock_parse_other_score): mock_pfunc.return_value = [1, 2, 3, 4, 5] mock_parse_canflip_score.return_value = [1, 2, 3, 4, 5, 6, 7] user_mod = self.single res = flips.parse_flips(user_mod) mock_pfunc.assert_called_once_with(' A 41 ASN ')
def test_with_non_single_non_set(self, mock_pfunc, mock_parse_methyl_score, mock_parse_canflip_score, mock_parse_other_score): '''Parsing USER MOD with no flip lines should return an empty list.''' user_mod = ['blah'] # not Set or Single res = flips.parse_flips(user_mod) mock_pfunc.assert_not_called() mock_parse_methyl_score.assert_not_called() mock_parse_canflip_score.assert_not_called() mock_parse_other_score.assert_not_called() self.assertEqual(res, [])
def test_with_single(self, mock_pfunc, mock_parse_methyl_score, mock_parse_canflip_score, mock_parse_other_score): mock_pfunc.return_value = [1, 2, 3, 4, 5] mock_parse_canflip_score.return_value = [1, 2, 3, 4, 5, 6, 7] user_mod = self.single res = flips.parse_flips(user_mod) assert type(res) is list assert len(res) == 1 f = res[0] assert f.flip_class == 'single' assert f.set is None assert f.set_index is None
def test_sets_flip_func_group_info(self, mock_pfunc, mock_parse_methyl_score, mock_parse_canflip_score, mock_parse_other_score): mock_pfunc.return_value = ['A', '100B', 'THR', 'OG1', ''] mock_parse_canflip_score.return_value = [1, 2, 3, 4, 5, 6, 7] user_mod = self.single res = flips.parse_flips(user_mod) f = res[0] assert f.chain == 'A' assert f.resi == '100B' assert f.resn == 'THR' assert f.name == 'OG1' assert f.alt == ''