# -*- coding: utf-8 -*-

# =================================================================
# uspec
#
# Copyright (c) 2020 Takahide Nogayama
#
# This software is released under the MIT License.
# http://opensource.org/licenses/mit-license.php
# =================================================================

from __future__ import unicode_literals, print_function, division

import unittest
import uspec
from uspec import describe, context, it


###################################
class TestGame(unittest.TestCase): pass


with describe("Game", test_class=TestGame):
    
    assert test_class is TestGame
    
    @it("hoge")
    def _(self):
        self.assertTrue(True)

assert TestGame is not None

##################################
TEST_CLASS_NAME_GAME2 = None

with describe("Game2"):
    TEST_CLASS_NAME_GAME2 = test_class.__name__

    @it("hoge")
    def _(self):
        self.assertTrue(True)

assert TEST_CLASS_NAME_GAME2 in globals()


##################################
def wrap():
    global TEST_CLASS_NAME_GAME3
    
    with describe("Game3"):
        
        TEST_CLASS_NAME_GAME3 = locals()["test_class"].__name__
        
        @it("hoge")
        def _(self):
            self.assertTrue(True)

    
wrap()

assert TEST_CLASS_NAME_GAME3 in globals()

if __name__ == '__main__':
    import unittest
    unittest.main(verbosity=2)

[((534, 571), 'uspec.describe', 'describe', (['"""Game"""'], {'test_class': 'TestGame'}), "('Game', test_class=TestGame)\n", (542, 571), False, 'from uspec import describe, context, it\n'), ((622, 632), 'uspec.it', 'it', (['"""hoge"""'], {}), "('hoge')\n", (624, 632), False, 'from uspec import describe, context, it\n'), ((780, 797), 'uspec.describe', 'describe', (['"""Game2"""'], {}), "('Game2')\n", (788, 797), False, 'from uspec import describe, context, it\n'), ((853, 863), 'uspec.it', 'it', (['"""hoge"""'], {}), "('hoge')\n", (855, 863), False, 'from uspec import describe, context, it\n'), ((1334, 1360), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (1347, 1360), False, 'import unittest\n'), ((1050, 1067), 'uspec.describe', 'describe', (['"""Game3"""'], {}), "('Game3')\n", (1058, 1067), False, 'from uspec import describe, context, it\n'), ((1160, 1170), 'uspec.it', 'it', (['"""hoge"""'], {}), "('hoge')\n", (1162, 1170), False, 'from uspec import describe, context, it\n')]