# Path: pyqi/util.py
# def get_version_string(module_str):
#     """Returns the version string found in the top-level module.
# 
#     ``module_str`` should be a valid Python module name. __version__ will be
#     extracted from the top-level module and returned.
# 
#     For example, if ``module_str`` is 'foo.bar.baz', ``foo.__version__`` will
#     be returned. If ``__version__`` doesn't exist, a
#     ``MissingVersionInfoError`` is raised.
#     """
#     top_level_name = module_str.split('.')[0]
# 
#     try:
#         top_level_module = importlib.import_module(top_level_name)
#     except ImportError:
#         raise ImportError("Unable to import module '%s'" % top_level_name)
# 
#     try:
#         version_string = top_level_module.__version__
#     except AttributeError:
#         raise MissingVersionInfoError("Module '%s' does not have the "
#                 "__version__ attribute." % top_level_name)
# 
#     return version_string
# 
# Path: pyqi/core/exception.py
# class MissingVersionInfoError(IncompetentDeveloperError):
#     pass


import pyqi
from unittest import TestCase, main
from pyqi.util import get_version_string
from pyqi.core.exception import MissingVersionInfoError
#!/usr/bin/env python

#-----------------------------------------------------------------------------
# Copyright (c) 2013, The BiPy Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
from __future__ import division

__credits__ = ["Greg Caporaso", "Daniel McDonald", "Doug Wendel",
               "Jai Ram Rideout"]



class UtilTests(TestCase):
    def test_get_version_string(self):
        """Test extracting a version string given a module string."""
        exp = pyqi.__version__

        obs = get_version_string('pyqi')
        self.assertEqual(obs, exp)


# Path: pyqi/util.py
# def get_version_string(module_str):
#     """Returns the version string found in the top-level module.
# 
#     ``module_str`` should be a valid Python module name. __version__ will be
#     extracted from the top-level module and returned.
# 
#     For example, if ``module_str`` is 'foo.bar.baz', ``foo.__version__`` will
#     be returned. If ``__version__`` doesn't exist, a
#     ``MissingVersionInfoError`` is raised.
#     """
#     top_level_name = module_str.split('.')[0]
# 
#     try:
#         top_level_module = importlib.import_module(top_level_name)
#     except ImportError:
#         raise ImportError("Unable to import module '%s'" % top_level_name)
# 
#     try:
#         version_string = top_level_module.__version__
#     except AttributeError:
#         raise MissingVersionInfoError("Module '%s' does not have the "
#                 "__version__ attribute." % top_level_name)
# 
#     return version_string
# 
# Path: pyqi/core/exception.py
# class MissingVersionInfoError(IncompetentDeveloperError):
#     pass


# Path: tests/test_util.py
import pyqi
from unittest import TestCase, main
from pyqi.util import get_version_string
from pyqi.core.exception import MissingVersionInfoError

#!/usr/bin/env python

#-----------------------------------------------------------------------------
# Copyright (c) 2013, The BiPy Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
from __future__ import division

__credits__ = ["Greg Caporaso", "Daniel McDonald", "Doug Wendel",
               "Jai Ram Rideout"]



class UtilTests(TestCase):
    def test_get_version_string(self):
        """Test extracting a version string given a module string."""
        exp = pyqi.__version__

        obs = get_version_string('pyqi')
        self.assertEqual(obs, exp)


        obs = get_version_string('pyqi.interfaces.optparse.config')