mirror of
https://github.com/microsoft/autogen.git
synced 2026-04-20 03:02:16 -04:00
Replace the use of assert in non-test code (#80)
* Replace `assert`s in the `conversable_agent` module with `if-log-raise`. * Use a `logger` object in the `code_utils` module. * Replace use of `assert` with `if-log-raise` in the `code_utils` module. * Replace use of `assert` in the `math_utils` module with `if-not-raise`. * Replace `assert` with `if` in the `oai.completion` module. * Replace `assert` in the `retrieve_utils` module with an if statement. * Add missing `not`. * Blacken `completion.py`. * Test `generate_reply` and `a_generate_reply` raise an assertion error when there are neither `messages` nor a `sender`. * Test `execute_code` raises an `AssertionError` when neither code nor filename is provided. * Test `split_text_to_chunks` raises when passed an invalid chunk mode. * * Add `tiktoken` and `chromadb` to test dependencies as they're used in the `test_retrieve_utils` module. * Sort the test requirements alphabetically.
This commit is contained in:
@@ -264,6 +264,11 @@ def test_execute_code(use_docker=None):
|
||||
assert isinstance(image, str) or docker is None or os.path.exists("/.dockerenv") or use_docker is False
|
||||
|
||||
|
||||
def test_execute_code_raises_when_code_and_filename_are_both_none():
|
||||
with pytest.raises(AssertionError):
|
||||
execute_code(code=None, filename=None)
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
sys.platform in ["darwin"],
|
||||
reason="do not run on MacOS",
|
||||
|
||||
Reference in New Issue
Block a user