# Path: bento/core/options.py
# class PackageOptions(object):
#     @classmethod
#     def __from_data(cls, data):
#         raw = raw_parse(data)
#         kw = raw_to_options_kw(raw)
#         return cls(**kw)
# 
#     @classmethod
#     def from_string(cls, str):
#         """Create a PackageOptions instance from a bento.info content."""
#         return cls.__from_data(str)
# 
#     @classmethod
#     def from_file(cls, filename):
#         """Create a PackageOptions instance from a bento.info file."""
#         fid = open(filename, 'r')
#         try:
#             data = fid.read()
#             return cls.__from_data(data)
#         finally:
#             fid.close()
# 
#     def __init__(self, name, path_options=None, flag_options=None):
#         """Create a PackageOptions instance
# 
#         Parameters
#         ----------
#         name: str
#             name of the package
#         path_options: dict
#             dict of path options
#         flag_options: dict
#             dict of flag options
#         """
#         self.name = name
# 
#         if not path_options:
#             self.path_options = {}
#         else:
#             self.path_options = path_options
# 
#         if not flag_options:
#             self.flag_options = {}
#         else:
#             self.flag_options = flag_options


import sys
from bento.commands.contexts \
    import \
        GlobalContext
from bento.compat.api.moves \
    import \
        unittest
from bento.core.options \
    import \
        PackageOptions
from bento.core.platforms \
    import \
        get_scheme


class TestGlobalContextCustomizedOptions(unittest.TestCase):
    def setUp(self):
        self.context = GlobalContext(None)
        self.maxDiff = None

    def _test(self, package_options, r_scheme):
        self.context.register_package_options(package_options)
        scheme = self.context.retrieve_scheme()

        default_scheme, _ = get_scheme(sys.platform)
        r_scheme.update(default_scheme)
        r_scheme['py_version_short'] = ".".join(str(part) for part in sys.version_info[:2])
        r_scheme['pkgname'] = package_options.name

        self.assertEqual(scheme, r_scheme)

    def test_no_options(self):
        package_options = PackageOptions.from_string("""\
Name: foo
""")
        self._test(package_options, {})

    def test_path_option(self):

# Path: bento/core/options.py
# class PackageOptions(object):
#     @classmethod
#     def __from_data(cls, data):
#         raw = raw_parse(data)
#         kw = raw_to_options_kw(raw)
#         return cls(**kw)
# 
#     @classmethod
#     def from_string(cls, str):
#         """Create a PackageOptions instance from a bento.info content."""
#         return cls.__from_data(str)
# 
#     @classmethod
#     def from_file(cls, filename):
#         """Create a PackageOptions instance from a bento.info file."""
#         fid = open(filename, 'r')
#         try:
#             data = fid.read()
#             return cls.__from_data(data)
#         finally:
#             fid.close()
# 
#     def __init__(self, name, path_options=None, flag_options=None):
#         """Create a PackageOptions instance
# 
#         Parameters
#         ----------
#         name: str
#             name of the package
#         path_options: dict
#             dict of path options
#         flag_options: dict
#             dict of flag options
#         """
#         self.name = name
# 
#         if not path_options:
#             self.path_options = {}
#         else:
#             self.path_options = path_options
# 
#         if not flag_options:
#             self.flag_options = {}
#         else:
#             self.flag_options = flag_options


# Path: bento/commands/tests/test_contexts.py
import sys
from bento.commands.contexts \
    import \
        GlobalContext
from bento.compat.api.moves \
    import \
        unittest
from bento.core.options \
    import \
        PackageOptions
from bento.core.platforms \
    import \
        get_scheme



class TestGlobalContextCustomizedOptions(unittest.TestCase):
    def setUp(self):
        self.context = GlobalContext(None)
        self.maxDiff = None

    def _test(self, package_options, r_scheme):
        self.context.register_package_options(package_options)
        scheme = self.context.retrieve_scheme()

        default_scheme, _ = get_scheme(sys.platform)
        r_scheme.update(default_scheme)
        r_scheme['py_version_short'] = ".".join(str(part) for part in sys.version_info[:2])
        r_scheme['pkgname'] = package_options.name

        self.assertEqual(scheme, r_scheme)

    def test_no_options(self):
        package_options = PackageOptions.from_string("""\
Name: foo
""")
        self._test(package_options, {})

    def test_path_option(self):

        package_options = PackageOptions.from_string("""\