mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-01 11:56:24 +02:00
change req in exp
This commit is contained in:
parent
790ff55981
commit
4650b7bdf1
4 changed files with 71 additions and 15 deletions
29
tests/metagpt/utils/test_reflection.py
Normal file
29
tests/metagpt/utils/test_reflection.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
from metagpt.utils.reflection import get_func_or_method_name
|
||||
|
||||
|
||||
def simple_function():
|
||||
pass
|
||||
|
||||
|
||||
class SampleClass:
|
||||
def method(self):
|
||||
pass
|
||||
|
||||
|
||||
class TestFunctionOrMethodName:
|
||||
def test_simple_function(self):
|
||||
assert get_func_or_method_name(simple_function) == "simple_function"
|
||||
|
||||
def test_class_method_without_args(self):
|
||||
sample_instance = SampleClass()
|
||||
assert get_func_or_method_name(sample_instance.method) == "SampleClass.method"
|
||||
|
||||
def test_class_method_with_args(self):
|
||||
sample_instance = SampleClass()
|
||||
assert get_func_or_method_name(SampleClass.method, sample_instance) == "SampleClass.method"
|
||||
|
||||
def test_function_with_no_args(self):
|
||||
assert get_func_or_method_name(simple_function) == "simple_function"
|
||||
|
||||
def test_method_without_instance(self):
|
||||
assert get_func_or_method_name(SampleClass.method) == "method"
|
||||
Loading…
Add table
Add a link
Reference in a new issue