# Path: gh/base.py
# class Command(object):
# class CustomOptionParser(OptionParser):
#     SUCCESS = 0
#     FAILURE = 1
#     COMMAND_UNKNOWN = 127
#     def __init__(self):
#     def run(self, options, args):
#     def get_repo(self, options):
#     def get_user(self):
#     def login(self):
#     def help(self):
#     def __init__(self, *args, **kwargs):
# def load_command(name):


from unittest import TestCase
from gh.base import (Command, CustomOptionParser, load_command, commands,
                     main_parser)
import sys
    def test_help(self):
        c = CustomOptionParser()
        assert c.has_option('-h') is True
        assert c.defaults == {'help': False}


class TestBase(TestCase):
    command = 'issue'
    mod = 'gh.commands.issue'

    def setUp(self):
        self.mods = sys.modules.copy()
        if self.mod in sys.modules:
            del sys.modules[self.mod]

        global commands
        if self.command in commands:
            del commands[self.command]

    def tearDown(self):
        sys.modules.update(self.mods)

    def test_load_command(self):
        load_command(self.command)
        assert self.mod in sys.modules
        load_command('foobarbogus')
        assert 'gh.commands.foobarbogus' not in sys.modules

    def test_commands(self):
        assert self.command not in commands

# Path: gh/base.py
# class Command(object):
# class CustomOptionParser(OptionParser):
#     SUCCESS = 0
#     FAILURE = 1
#     COMMAND_UNKNOWN = 127
#     def __init__(self):
#     def run(self, options, args):
#     def get_repo(self, options):
#     def get_user(self):
#     def login(self):
#     def help(self):
#     def __init__(self, *args, **kwargs):
# def load_command(name):


# Path: tests/test_base.py
from unittest import TestCase
from gh.base import (Command, CustomOptionParser, load_command, commands,
                     main_parser)
import sys

    def test_help(self):
        c = CustomOptionParser()
        assert c.has_option('-h') is True
        assert c.defaults == {'help': False}


class TestBase(TestCase):
    command = 'issue'
    mod = 'gh.commands.issue'

    def setUp(self):
        self.mods = sys.modules.copy()
        if self.mod in sys.modules:
            del sys.modules[self.mod]

        global commands
        if self.command in commands:
            del commands[self.command]

    def tearDown(self):
        sys.modules.update(self.mods)

    def test_load_command(self):
        load_command(self.command)
        assert self.mod in sys.modules
        load_command('foobarbogus')
        assert 'gh.commands.foobarbogus' not in sys.modules

    def test_commands(self):
        assert self.command not in commands

        load_command(self.command)