openai/openai-python
Publicmirrored fromhttps://github.com/openai/openai-pythonAvailable
tests/lib/test_old_api.py
17lines · modecode
| 1 | import pytest |
| 2 | |
| 3 | import openai |
| 4 | from openai.lib._old_api import APIRemovedInV1 |
| 5 | |
| 6 | |
| 7 | def test_basic_attribute_access_works() -> None: |
| 8 | for attr in dir(openai): |
| 9 | getattr(openai, attr) |
| 10 | |
| 11 | |
| 12 | def test_helpful_error_is_raised() -> None: |
| 13 | with pytest.raises(APIRemovedInV1): |
| 14 | openai.Completion.create() # type: ignore |
| 15 | |
| 16 | with pytest.raises(APIRemovedInV1): |
| 17 | openai.ChatCompletion.create() # type: ignore |
| 18 | |