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