from .. utils import TranspileTestCase, BuiltinFunctionTestCase


class ReversedTests(TranspileTestCase):
    pass


class BuiltinReversedFunctionTests(BuiltinFunctionTestCase, TranspileTestCase):
    functions = ["reversed"]

    not_implemented = [
        'test_range',
    ]

from .. utils import SAMPLE_DATA, TranspileTestCase, BuiltinFunctionTestCase


def _iterate_test(datatype):

    def test_func(self):
        code = '\n'.join([
            '\nfor x in {value}:\n    print(x)\n'.format(value=value)
            for value in SAMPLE_DATA[datatype]
        ])
        self.assertCodeExecution(code)

    return test_func


class ReversedTests(TranspileTestCase):
    # test_iterate_bytearray = _iterate_test('bytearray')
    test_iterate_bytes = _iterate_test('bytes')
    test_iterate_list = _iterate_test('list')
    test_iterate_range = _iterate_test('range')
    test_iterate_str = _iterate_test('str')
    test_iterate_tuple = _iterate_test('tuple')


class BuiltinReversedFunctionTests(BuiltinFunctionTestCase, TranspileTestCase):
    functions = ["reversed"]

    not_implemented = [
        'test_range',
    ]

Add iteration tests for reversed type
Add iteration tests for reversed type

- from .. utils import TranspileTestCase, BuiltinFunctionTestCase
+ from .. utils import SAMPLE_DATA, TranspileTestCase, BuiltinFunctionTestCase
+ 
+ 
+ def _iterate_test(datatype):
+ 
+     def test_func(self):
+         code = '\n'.join([
+             '\nfor x in {value}:\n    print(x)\n'.format(value=value)
+             for value in SAMPLE_DATA[datatype]
+         ])
+         self.assertCodeExecution(code)
+ 
+     return test_func
  
  
  class ReversedTests(TranspileTestCase):
-     pass
+     # test_iterate_bytearray = _iterate_test('bytearray')
+     test_iterate_bytes = _iterate_test('bytes')
+     test_iterate_list = _iterate_test('list')
+     test_iterate_range = _iterate_test('range')
+     test_iterate_str = _iterate_test('str')
+     test_iterate_tuple = _iterate_test('tuple')
  
  
  class BuiltinReversedFunctionTests(BuiltinFunctionTestCase, TranspileTestCase):
      functions = ["reversed"]
  
      not_implemented = [
          'test_range',
      ]
  
Add iteration tests for reversed type
## Code Before:
from .. utils import TranspileTestCase, BuiltinFunctionTestCase


class ReversedTests(TranspileTestCase):
    pass


class BuiltinReversedFunctionTests(BuiltinFunctionTestCase, TranspileTestCase):
    functions = ["reversed"]

    not_implemented = [
        'test_range',
    ]

## Instruction:
Add iteration tests for reversed type
## Code After:
from .. utils import SAMPLE_DATA, TranspileTestCase, BuiltinFunctionTestCase


def _iterate_test(datatype):

    def test_func(self):
        code = '\n'.join([
            '\nfor x in {value}:\n    print(x)\n'.format(value=value)
            for value in SAMPLE_DATA[datatype]
        ])
        self.assertCodeExecution(code)

    return test_func


class ReversedTests(TranspileTestCase):
    # test_iterate_bytearray = _iterate_test('bytearray')
    test_iterate_bytes = _iterate_test('bytes')
    test_iterate_list = _iterate_test('list')
    test_iterate_range = _iterate_test('range')
    test_iterate_str = _iterate_test('str')
    test_iterate_tuple = _iterate_test('tuple')


class BuiltinReversedFunctionTests(BuiltinFunctionTestCase, TranspileTestCase):
    functions = ["reversed"]

    not_implemented = [
        'test_range',
    ]
