mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-27 11:10:31 +08:00
refactor: remove unused code
This commit is contained in:
@@ -205,22 +205,3 @@ def is_function(item):
|
|||||||
""" Takes item object, returns True if it is a function.
|
""" Takes item object, returns True if it is a function.
|
||||||
"""
|
"""
|
||||||
return isinstance(item, types.FunctionType)
|
return isinstance(item, types.FunctionType)
|
||||||
|
|
||||||
|
|
||||||
def is_variable(tup):
|
|
||||||
""" Takes (name, object) tuple, returns True if it is a variable.
|
|
||||||
"""
|
|
||||||
name, item = tup
|
|
||||||
if callable(item):
|
|
||||||
# function or class
|
|
||||||
return False
|
|
||||||
|
|
||||||
if isinstance(item, types.ModuleType):
|
|
||||||
# imported module
|
|
||||||
return False
|
|
||||||
|
|
||||||
if name.startswith("_"):
|
|
||||||
# private property
|
|
||||||
return False
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|||||||
@@ -60,17 +60,3 @@ class TestLoaderCheck(unittest.TestCase):
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
self.assertTrue(data_structure)
|
self.assertTrue(data_structure)
|
||||||
|
|
||||||
def test_is_variable(self):
|
|
||||||
var1 = 123
|
|
||||||
var2 = "abc"
|
|
||||||
self.assertTrue(check.is_variable(("var1", var1)))
|
|
||||||
self.assertTrue(check.is_variable(("var2", var2)))
|
|
||||||
|
|
||||||
__var = 123
|
|
||||||
self.assertFalse(check.is_variable(("__var", __var)))
|
|
||||||
|
|
||||||
func = lambda x: x + 1
|
|
||||||
self.assertFalse(check.is_variable(("func", func)))
|
|
||||||
|
|
||||||
self.assertFalse(check.is_variable(("unittest", unittest)))
|
|
||||||
|
|||||||
Reference in New Issue
Block a user