示例#1
0
    def test_generate_key_unknown(self):
        """ Test that unknown module functions return as strings """
        def test_func(): pass

        stat = Mock()
        stat.code = test_func.__code__

        expected_key = "%s.%s" % (stat.code.co_filename, stat.code.co_name)
        key = linesman._generate_key(stat)
        assert_equals(key, expected_key)
示例#2
0
    def test_generate_key_module(self):
        """ Test that a key is generated for module functions """
        def test_func(): pass

        stat = Mock()
        stat.code = test_func.__code__

        expected_key = "%s.%s" % (self.__module__, stat.code.co_name)
        key = linesman._generate_key(stat)
        assert_equals(key, expected_key)
示例#3
0
    def test_generate_key_unknown(self):
        """ Test that unknown module functions return as strings """
        def test_func():
            pass

        stat = Mock()
        stat.code = test_func.__code__

        expected_key = "%s.%s" % (stat.code.co_filename, stat.code.co_name)
        key = linesman._generate_key(stat)
        assert_equals(key, expected_key)
示例#4
0
    def test_generate_key_module(self):
        """ Test that a key is generated for module functions """
        def test_func():
            pass

        stat = Mock()
        stat.code = test_func.__code__

        expected_key = "%s.%s" % (self.__module__, stat.code.co_name)
        key = linesman._generate_key(stat)
        assert_equals(key, expected_key)
示例#5
0
 def test_generate_key_builtin(self):
     """ Test that a key is generated for built-in functions """
     stat = Mock()
     stat.code = "__builtin__"
     key = linesman._generate_key(stat)
     assert_equals(key, stat.code)
示例#6
0
 def test_generate_key_builtin(self):
     """ Test that a key is generated for built-in functions """
     stat = Mock()
     stat.code = "__builtin__"
     key = linesman._generate_key(stat)
     assert_equals(key, stat.code)