import unittest

import sys

from tests.utils import requires_python_version


class TestTreeTrace(unittest.TestCase):
    maxDiff = None

    @requires_python_version(3.5)
    def test_async_forbidden(self):
        def check(body):
            with self.assertRaises(ValueError):
                exec("""
from birdseye.tracer import TreeTracerBase
@TreeTracerBase()
async def f(): """ + body)

        check('pass')

        if sys.version_info >= (3, 6):
            check('yield 1')

import sys
import unittest

from tests.utils import requires_python_version


class TestTreeTrace(unittest.TestCase):
    maxDiff = None

    @requires_python_version(3.5)
    def test_async_forbidden(self):
        from birdseye.tracer import TreeTracerBase
        tracer = TreeTracerBase()
        with self.assertRaises(ValueError):
            exec("""
@tracer
async def f(): pass""")

        if sys.version_info >= (3, 6):
            with self.assertRaises(ValueError):
                exec("""
@tracer
async def f(): yield 1""")

Fix inner exec syntax error in python 2.7
Fix inner exec syntax error in python 2.7

+ import sys
  import unittest
- 
- import sys
  
  from tests.utils import requires_python_version
  
  
  class TestTreeTrace(unittest.TestCase):
      maxDiff = None
  
      @requires_python_version(3.5)
      def test_async_forbidden(self):
-         def check(body):
+         from birdseye.tracer import TreeTracerBase
+         tracer = TreeTracerBase()
+         with self.assertRaises(ValueError):
+             exec("""
+ @tracer
+ async def f(): pass""")
+ 
+         if sys.version_info >= (3, 6):
              with self.assertRaises(ValueError):
                  exec("""
+ @tracer
+ async def f(): yield 1""")
- from birdseye.tracer import TreeTracerBase
- @TreeTracerBase()
- async def f(): """ + body)
  
-         check('pass')
- 
-         if sys.version_info >= (3, 6):
-             check('yield 1')
- 
Fix inner exec syntax error in python 2.7
## Code Before:
import unittest

import sys

from tests.utils import requires_python_version


class TestTreeTrace(unittest.TestCase):
    maxDiff = None

    @requires_python_version(3.5)
    def test_async_forbidden(self):
        def check(body):
            with self.assertRaises(ValueError):
                exec("""
from birdseye.tracer import TreeTracerBase
@TreeTracerBase()
async def f(): """ + body)

        check('pass')

        if sys.version_info >= (3, 6):
            check('yield 1')

## Instruction:
Fix inner exec syntax error in python 2.7
## Code After:
import sys
import unittest

from tests.utils import requires_python_version


class TestTreeTrace(unittest.TestCase):
    maxDiff = None

    @requires_python_version(3.5)
    def test_async_forbidden(self):
        from birdseye.tracer import TreeTracerBase
        tracer = TreeTracerBase()
        with self.assertRaises(ValueError):
            exec("""
@tracer
async def f(): pass""")

        if sys.version_info >= (3, 6):
            with self.assertRaises(ValueError):
                exec("""
@tracer
async def f(): yield 1""")
