def test_silac(self):
     t = ParamGroup(mk_pg_root())
     t.set_silac(None, None, ('Arg10', 'Lys4'))
     assert t._root.find('.maxLabeledAa').text == '2'
     assert t._root.find('.multiplicity').text == '2'
     assert t._root.find('.labelMods')[1].text == 'Arg10;Lys4'
     assert t._root.find('.labelMods')[0].text == ''
    def test_list_param(self):
        t = ParamGroup(mk_pg_root())
        t.set_list_param('enzymes', ('test 1', 'test 2'))
        assert len(t._root.find('enzymes')) == 2

        t.set_list_param('variableModifications', ('Oxidation (M)', ))
        assert t._root.find('variableModifications')[0].text == 'Oxidation (M)'

        with pytest.raises(ValueError):
            t.set_list_param('foo', [])
    def test_isobaric_label(self):
        t = ParamGroup(mk_pg_root())
        t.set_isobaric_label('iTRAQ4plex-Lys114', 'iTRAQ4plex-Nter114', 0.3, 1,
                             1.2, 0, True)

        assert len(t._root.find('isobaricLabels')) == 1
        assert len(t._root.find('isobaricLabels')[0]) == 7

        t.set_isobaric_label('iTRAQ4plex-Lys115', 'iTRAQ4plex-Nter115', 0.3,
                             1.0, 1.2, 0, True)

        assert len(t._root.find('isobaricLabels')) == 2

        tag_list = [el.tag for el in t._root.find('isobaricLabels')[1]]
        assert tag_list == [
            'internalLabel', 'terminalLabel', 'correctionFactorM2',
            'correctionFactorM1', 'correctionFactorP1', 'correctionFactorP2',
            'tmtLike'
        ]

        text_list = [el.text for el in t._root.find('isobaricLabels')[1]]
        assert text_list == [
            'iTRAQ4plex-Lys115', 'iTRAQ4plex-Nter115', '0.3', '1', '1.2', '0',
            'True'
        ]
    def test_simple_params(self):
        t = ParamGroup(mk_pg_root())
        t.set_simple_param('fastLfq', False)
        assert t._root.find('.fastLfq').text == 'False'

        with pytest.raises(ValueError):
            t.set_simple_param('foo', 2)