def test_list_pkgs(self):
        mock_run = MagicMock(return_value='A\t B\t SAME')
        mock_ret = MagicMock(return_value=True)
        mock_pkg = MagicMock(return_value='')
        with patch.dict(pkgutil.__salt__,
                        {'cmd.run_stdout': mock_run,
                         'cmd.retcode': mock_ret,
                         'pkg_resource.stringify': mock_pkg,
                         'pkg_resource.sort_pkglist': mock_pkg,
                         'cmd.run': mock_run}):
            with patch.dict(pkgutil.__context__, {'pkg.list_pkgs': mock_ret}):
                self.assertDictEqual(pkgutil.list_pkgs(versions_as_list=True,
                                                       removed=True), {})

            self.assertDictEqual(pkgutil.list_pkgs(), {})

        with patch.dict(pkgutil.__context__, {'pkg.list_pkgs': True}):
            self.assertTrue(pkgutil.list_pkgs(versions_as_list=True))

            mock_pkg = MagicMock(return_value=True)
            with patch.dict(pkgutil.__salt__,
                            {'pkg_resource.stringify': mock_pkg}):
                self.assertTrue(pkgutil.list_pkgs())

    # 'version' function tests: 1
expression
dataset/ETHPy150Open saltstack/salt/tests/unit/modules/pkgutil_test.py/PkgutilTestCase.test_list_pkgs--crossover with--dataset/ETHPy150Open xraypy/xraylarch/lib/interpreter.py/Interpreter.on_expr