from unittest import TestCase
from click.testing import CliRunner

import yoda


class TestHoroscope(TestCase):
    """
        Test for the following commands:

        | Module: dev
        | command: horoscope
    """

    def __init__(self, methodName='runTest'):
        super(TestHoroscope, self).__init__()
        self.runner = CliRunner()

    def runTest(self):
        result = self.runner.invoke(yoda.cli, ['horoscope', 'aries'])
        self.assertTrue(type(result.output.encode('ascii', 'ignore')) == str)

import sys
from unittest import TestCase
from click.testing import CliRunner

import yoda


class TestHoroscope(TestCase):
    """
        Test for the following commands:

        | Module: dev
        | command: horoscope
    """

    def __init__(self, methodName='runTest'):
        super(TestHoroscope, self).__init__()
        self.runner = CliRunner()

    def runTest(self):
        result = self.runner.invoke(yoda.cli, ['horoscope', 'aries'])

        if sys.version_info[0] == 3:
            string_types = str
        else:
            string_types = basestring

        self.assertIsInstance(result.output, string_types)

Fix broken test for Python 2.x/3.x
Fix broken test for Python 2.x/3.x

+ import sys
  from unittest import TestCase
  from click.testing import CliRunner
  
  import yoda
  
  
  class TestHoroscope(TestCase):
      """
          Test for the following commands:
  
          | Module: dev
          | command: horoscope
      """
  
      def __init__(self, methodName='runTest'):
          super(TestHoroscope, self).__init__()
          self.runner = CliRunner()
  
      def runTest(self):
          result = self.runner.invoke(yoda.cli, ['horoscope', 'aries'])
-         self.assertTrue(type(result.output.encode('ascii', 'ignore')) == str)
  
+         if sys.version_info[0] == 3:
+             string_types = str
+         else:
+             string_types = basestring
+ 
+         self.assertIsInstance(result.output, string_types)
+ 
Fix broken test for Python 2.x/3.x
## Code Before:
from unittest import TestCase
from click.testing import CliRunner

import yoda


class TestHoroscope(TestCase):
    """
        Test for the following commands:

        | Module: dev
        | command: horoscope
    """

    def __init__(self, methodName='runTest'):
        super(TestHoroscope, self).__init__()
        self.runner = CliRunner()

    def runTest(self):
        result = self.runner.invoke(yoda.cli, ['horoscope', 'aries'])
        self.assertTrue(type(result.output.encode('ascii', 'ignore')) == str)

## Instruction:
Fix broken test for Python 2.x/3.x
## Code After:
import sys
from unittest import TestCase
from click.testing import CliRunner

import yoda


class TestHoroscope(TestCase):
    """
        Test for the following commands:

        | Module: dev
        | command: horoscope
    """

    def __init__(self, methodName='runTest'):
        super(TestHoroscope, self).__init__()
        self.runner = CliRunner()

    def runTest(self):
        result = self.runner.invoke(yoda.cli, ['horoscope', 'aries'])

        if sys.version_info[0] == 3:
            string_types = str
        else:
            string_types = basestring

        self.assertIsInstance(result.output, string_types)
