Exemplo n.º 1
0
    def test_func_name(self):
        # check that func_name works on anything callable, not only funcs.
        assert "nothing" == some_function()
        assert "tests.tracer.test_utils.some_function" == func_name(some_function)

        f = SomethingCallable()
        assert "something" == f()
        assert "tests.tracer.test_utils.SomethingCallable" == func_name(f)

        assert f == f.me()
        assert "tests.tracer.test_utils.me" == func_name(f.me)
        assert 3 == f.add(1, 2)
        assert "tests.tracer.test_utils.add" == func_name(f.add)
        assert 42 == f.answer()
        assert "tests.tracer.test_utils.answer" == func_name(f.answer)

        assert "tests.tracer.test_utils.minus" == func_name(minus)
        assert 5 == minus_two(7)
        assert "partial" == func_name(minus_two)
        assert 10 == plus_three(7)
        assert "tests.tracer.test_utils.<lambda>" == func_name(plus_three)
Exemplo n.º 2
0
    def test_func_name(self):
        # check that func_name works on anything callable, not only funcs.
        eq_('nothing', some_function())
        eq_('tests.contrib.test_utils.some_function', func_name(some_function))

        f = SomethingCallable()
        eq_('something', f())
        eq_('tests.contrib.test_utils.SomethingCallable', func_name(f))

        eq_(f, f.me())
        eq_('tests.contrib.test_utils.me', func_name(f.me))
        eq_(3, f.add(1, 2))
        eq_('tests.contrib.test_utils.add', func_name(f.add))
        eq_(42, f.answer())
        eq_('tests.contrib.test_utils.answer', func_name(f.answer))

        eq_('tests.contrib.test_utils.minus', func_name(minus))
        eq_(5, minus_two(7))
        eq_('partial', func_name(minus_two))
        eq_(10, plus_three(7))
        eq_('tests.contrib.test_utils.<lambda>', func_name(plus_three))
Exemplo n.º 3
0
    def test_func_name(self):
        # check that func_name works on anything callable, not only funcs.
        eq_('nothing', some_function())
        eq_('tests.contrib.test_utils.some_function', func_name(some_function))

        f = SomethingCallable()
        eq_('something', f())
        eq_('tests.contrib.test_utils.SomethingCallable', func_name(f))

        eq_(f, f.me())
        eq_('tests.contrib.test_utils.me', func_name(f.me))
        eq_(3, f.add(1,2))
        eq_('tests.contrib.test_utils.add', func_name(f.add))
        eq_(42, f.answer())
        eq_('tests.contrib.test_utils.answer', func_name(f.answer))

        eq_('tests.contrib.test_utils.minus', func_name(minus))
        eq_(5, minus_two(7))
        eq_('partial', func_name(minus_two))
        eq_(10, plus_three(7))
        eq_('tests.contrib.test_utils.<lambda>', func_name(plus_three))
Exemplo n.º 4
0
    def test_func_name(self):
        # check that func_name works on anything callable, not only funcs.
        assert 'nothing' == some_function()
        assert 'tests.contrib.test_utils.some_function' == func_name(some_function)

        f = SomethingCallable()
        assert 'something' == f()
        assert 'tests.contrib.test_utils.SomethingCallable' == func_name(f)

        assert f == f.me()
        assert 'tests.contrib.test_utils.me' == func_name(f.me)
        assert 3 == f.add(1, 2)
        assert 'tests.contrib.test_utils.add' == func_name(f.add)
        assert 42 == f.answer()
        assert 'tests.contrib.test_utils.answer' == func_name(f.answer)

        assert 'tests.contrib.test_utils.minus' == func_name(minus)
        assert 5 == minus_two(7)
        assert 'partial' == func_name(minus_two)
        assert 10 == plus_three(7)
        assert 'tests.contrib.test_utils.<lambda>' == func_name(plus_three)