Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)