# -*- 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)

[((23, 5, 23, 42), 'uspec.describe', 'describe', (), '', False, 'from uspec import describe, context, it\n'), ((27, 5, 27, 15), 'uspec.it', 'it', ({(27, 8, 27, 14): '"""hoge"""'}, {}), "('hoge')", False, 'from uspec import describe, context, it\n'), ((36, 5, 36, 22), 'uspec.describe', 'describe', ({(36, 14, 36, 21): '"""Game2"""'}, {}), "('Game2')", False, 'from uspec import describe, context, it\n'), ((39, 5, 39, 15), 'uspec.it', 'it', ({(39, 8, 39, 14): '"""hoge"""'}, {}), "('hoge')", False, 'from uspec import describe, context, it\n'), ((65, 4, 65, 30), 'unittest.main', 'unittest.main', (), '', False, 'import unittest\n'), ((50, 9, 50, 26), 'uspec.describe', 'describe', ({(50, 18, 50, 25): '"""Game3"""'}, {}), "('Game3')", False, 'from uspec import describe, context, it\n'), ((54, 9, 54, 19), 'uspec.it', 'it', ({(54, 12, 54, 18): '"""hoge"""'}, {}), "('hoge')", False, 'from uspec import describe, context, it\n')]