parent
4d82c0b87a
commit
6714b584a5
@ -0,0 +1,33 @@
|
||||
iimport pytest
|
||||
from unittest.mock import Mock
|
||||
from your_module import interpreter_info, system_info # replace with your actual module name
|
||||
|
||||
def test_interpreter_info(mocker):
|
||||
mocker.patch('subprocess.check_output', return_value='curl output')
|
||||
interpreter = Mock()
|
||||
interpreter.offline = True
|
||||
interpreter.llm.api_base = 'http://api_base'
|
||||
interpreter.llm.supports_vision = True
|
||||
interpreter.llm.model = 'model'
|
||||
interpreter.llm.supports_functions = True
|
||||
interpreter.llm.context_window = 'context_window'
|
||||
interpreter.llm.max_tokens = 100
|
||||
interpreter.auto_run = True
|
||||
interpreter.llm.api_base = 'http://api_base'
|
||||
interpreter.offline = True
|
||||
interpreter.system_message = 'system_message'
|
||||
interpreter.messages = [{'content': 'message_content'}]
|
||||
result = interpreter_info(interpreter)
|
||||
assert 'curl output' in result
|
||||
|
||||
def test_system_info(mocker):
|
||||
mocker.patch('your_module.get_oi_version', return_value=('cmd_version', 'pkg_version')) # replace with your actual module name
|
||||
mocker.patch('your_module.get_python_version', return_value='python_version') # replace with your actual module name
|
||||
mocker.patch('your_module.get_pip_version', return_value='pip_version') # replace with your actual module name
|
||||
mocker.patch('your_module.get_os_version', return_value='os_version') # replace with your actual module name
|
||||
mocker.patch('your_module.get_cpu_info', return_value='cpu_info') # replace with your actual module name
|
||||
mocker.patch('your_module.get_ram_info', return_value='ram_info') # replace with your actual module name
|
||||
mocker.patch('your_module.interpreter_info', return_value='interpreter_info') # replace with your actual module name
|
||||
interpreter = Mock()
|
||||
result = system_info(interpreter)
|
||||
assert 'interpreter_info' in result
|
Loading…
Reference in new issue