def install(h, pip, groups, save, save_dev, packages):
    """Install a pip or bower package."""
    if groups:
        groups = [text_type.strip(group) for group in groups.split(",")]
    else:
        groups = h.requirements.keys()

    if not packages:
        for group in groups:
            if group not in h.requirements:
                warning("{} not in requirements".format(group))
                continue
            install = (h.install_bower if group.startswith("bower")
                       else h.install_pip)
            for requirement in h.requirements[group]:
                install(str(requirement), save=False, save_dev=False)
    if pip:
        for package in packages:
            h.install_pip(package, save=save, save_dev=save_dev)
    else:
        for package in packages:
            h.install_bower(package, save=save, save_dev=save_dev)
def test_convert_html_in_suggestion_change(self):
        html_content = (
            '<p>Value</p><oppia-noninteractive-math raw_latex-with-value="&a'
            'mp;quot;+,-,-,+&amp;quot;"></oppia-noninteractive-math>')
        expected_html_content = (
            '<p>Value</p><oppia-noninteractive-math math_content-with-value='
            '"{&amp;quot;raw_latex&amp;quot;: &amp;quot;+,-,-,+&amp;quot;, &'
            'amp;quot;svg_filename&amp;quot;: &amp;quot;&amp;quot;}"></oppia'
            '-noninteractive-math>')
        change_dict = {
            'cmd': exp_domain.CMD_ADD_WRITTEN_TRANSLATION,
            'state_name': 'Introduction',
            'content_id': 'content',
            'language_code': 'hi',
            'content_html': html_content,
            'translation_html': '<p>This is translated html.</p>',
            'data_format': 'html'
        }
        suggestion = suggestion_registry.SuggestionTranslateContent(
            self.suggestion_dict['suggestion_id'],
            self.suggestion_dict['target_id'],
            self.suggestion_dict['target_version_at_submission'],
            self.suggestion_dict['status'], self.author_id,
            self.reviewer_id, change_dict,
            self.suggestion_dict['score_category'],
            self.suggestion_dict['language_code'], False, self.fake_date)
        suggestion.convert_html_in_suggestion_change(
            html_validation_service.add_math_content_to_math_rte_components)
        self.assertEqual(
            suggestion.change.content_html, expected_html_content)