コード例 #1
0
ファイル: test_units.py プロジェクト: kmanalo/nose-nicedots
    def test_method_unittest(self):
        class TC(unittest.TestCase):
            def test(self):
                pass

        eq_(nice_test_address(TC('test')),
            'nosenicedots/tests/test_units.py:TC.test')

        case = nose.case.Test(TC('test'))
        eq_(nice_test_address(case),
            'nosenicedots/tests/test_units.py:TC.test')
コード例 #2
0
ファイル: test_units.py プロジェクト: kmanalo/nose-nicedots
    def test_function(self):
        def func():
            pass

        case = nose.case.FunctionTestCase(func)
        eq_(nice_test_address(case),
            'nosenicedots/tests/test_units.py:func')
コード例 #3
0
ファイル: test_units.py プロジェクト: kmanalo/nose-nicedots
 def test_catastropic_failure(self):
     try:
         raise RuntimeError("really big error")
     except:
         exc = sys.exc_info()
     case = Failure(exc[0], exc[1], exc[2], address=None)
     eq_(nice_test_address(case),
         '??')
コード例 #4
0
ファイル: test_units.py プロジェクト: kmanalo/nose-nicedots
    def test_method_raw(self):
        class TC(object):
            def test(self):
                pass

        case = nose.case.MethodTestCase(unbound_method(TC, TC.test))
        eq_(nice_test_address(case),
            'nosenicedots/tests/test_units.py:TC.test')
コード例 #5
0
ファイル: test_units.py プロジェクト: kmanalo/nose-nicedots
 def test_syntax_error(self):
     try:
         raise RuntimeError(
                 "more realistically this would be a SyntaxError")
     except:
         exc = sys.exc_info()
     case = Failure(exc[0], exc[1], tb=exc[2],
                    address=('some_file.py', None, None))
     eq_(nice_test_address(case), 'some_file.py')
コード例 #6
0
ファイル: test_units.py プロジェクト: kmanalo/nose-nicedots
    def test_generator(self):
        def fn(x):
            pass
        def gen():
            yield fn, (1,)

        case = nose.case.FunctionTestCase(gen)
        eq_(nice_test_address(case),
            'nosenicedots/tests/test_units.py:gen')
コード例 #7
0
ファイル: test_units.py プロジェクト: kmanalo/nose-nicedots
    def test_method_gen(self):
        def fn(x):
            pass
        class TC(object):
            def test_gen(self):
                yield fn, (1,)

        case = nose.case.MethodTestCase(unbound_method(TC, TC.test_gen))
        eq_(nice_test_address(case),
            'nosenicedots/tests/test_units.py:TC.test_gen')
コード例 #8
0
ファイル: test_units.py プロジェクト: kmanalo/nose-nicedots
    def test_context_suite(self):
        class module:
            def setup(self):
                pass
            def teardown(self):
                pass

        context = module()
        suite = nose.suite.ContextSuite([], context=context)
        def setup():
            pass
        def func():
            pass

        eq_(nice_test_address(suite),
            'nosenicedots/tests/test_units.py:module')