# Path: thefuck/rules/cd_cs.py
# def match(command):
#     if command.script_parts[0] == 'cs':
#         return True
# 
# def get_new_command(command):
#     return 'cd' + ''.join(command.script[2:])
# 
# Path: thefuck/types.py
# class Command(object):
#     """Command that should be fixed."""
# 
#     def __init__(self, script, output):
#         """Initializes command with given values.
# 
#         :type script: basestring
#         :type output: basestring
# 
#         """
#         self.script = script
#         self.output = output
# 
#     @property
#     def stdout(self):
#         logs.warn('`stdout` is deprecated, please use `output` instead')
#         return self.output
# 
#     @property
#     def stderr(self):
#         logs.warn('`stderr` is deprecated, please use `output` instead')
#         return self.output
# 
#     @property
#     def script_parts(self):
#         if not hasattr(self, '_script_parts'):
#             try:
#                 self._script_parts = shell.split_command(self.script)
#             except Exception:
#                 logs.debug(u"Can't split command script {} because:\n {}".format(
#                     self, sys.exc_info()))
#                 self._script_parts = []
# 
#         return self._script_parts
# 
#     def __eq__(self, other):
#         if isinstance(other, Command):
#             return (self.script, self.output) == (other.script, other.output)
#         else:
#             return False
# 
#     def __repr__(self):
#         return u'Command(script={}, output={})'.format(
#             self.script, self.output)
# 
#     def update(self, **kwargs):
#         """Returns new command with replaced fields.
# 
#         :rtype: Command
# 
#         """
#         kwargs.setdefault('script', self.script)
#         kwargs.setdefault('output', self.output)
#         return Command(**kwargs)
# 
#     @classmethod
#     def from_raw_script(cls, raw_script):
#         """Creates instance of `Command` from a list of script parts.
# 
#         :type raw_script: [basestring]
#         :rtype: Command
#         :raises: EmptyCommand
# 
#         """
#         script = format_raw_script(raw_script)
#         if not script:
#             raise EmptyCommand
# 
#         expanded = shell.from_shell(script)
#         output = get_output(script, expanded)
#         return cls(expanded, output)


from thefuck.rules.cd_cs import match, get_new_command
from thefuck.types import Command


def test_match():
    assert match(Command('cs', 'cs: command not found'))
    assert match(Command('cs /etc/', 'cs: command not found'))


def test_get_new_command():

# Path: thefuck/rules/cd_cs.py
# def match(command):
#     if command.script_parts[0] == 'cs':
#         return True
# 
# def get_new_command(command):
#     return 'cd' + ''.join(command.script[2:])
# 
# Path: thefuck/types.py
# class Command(object):
#     """Command that should be fixed."""
# 
#     def __init__(self, script, output):
#         """Initializes command with given values.
# 
#         :type script: basestring
#         :type output: basestring
# 
#         """
#         self.script = script
#         self.output = output
# 
#     @property
#     def stdout(self):
#         logs.warn('`stdout` is deprecated, please use `output` instead')
#         return self.output
# 
#     @property
#     def stderr(self):
#         logs.warn('`stderr` is deprecated, please use `output` instead')
#         return self.output
# 
#     @property
#     def script_parts(self):
#         if not hasattr(self, '_script_parts'):
#             try:
#                 self._script_parts = shell.split_command(self.script)
#             except Exception:
#                 logs.debug(u"Can't split command script {} because:\n {}".format(
#                     self, sys.exc_info()))
#                 self._script_parts = []
# 
#         return self._script_parts
# 
#     def __eq__(self, other):
#         if isinstance(other, Command):
#             return (self.script, self.output) == (other.script, other.output)
#         else:
#             return False
# 
#     def __repr__(self):
#         return u'Command(script={}, output={})'.format(
#             self.script, self.output)
# 
#     def update(self, **kwargs):
#         """Returns new command with replaced fields.
# 
#         :rtype: Command
# 
#         """
#         kwargs.setdefault('script', self.script)
#         kwargs.setdefault('output', self.output)
#         return Command(**kwargs)
# 
#     @classmethod
#     def from_raw_script(cls, raw_script):
#         """Creates instance of `Command` from a list of script parts.
# 
#         :type raw_script: [basestring]
#         :rtype: Command
#         :raises: EmptyCommand
# 
#         """
#         script = format_raw_script(raw_script)
#         if not script:
#             raise EmptyCommand
# 
#         expanded = shell.from_shell(script)
#         output = get_output(script, expanded)
#         return cls(expanded, output)


# Path: tests/rules/test_cd_cs.py
from thefuck.rules.cd_cs import match, get_new_command
from thefuck.types import Command



def test_match():
    assert match(Command('cs', 'cs: command not found'))
    assert match(Command('cs /etc/', 'cs: command not found'))


def test_get_new_command():

    assert get_new_command(Command('cs /etc/', 'cs: command not found')) == 'cd /etc/'