mirror of
https://github.com/kennethreitz/instructor.git
synced 2026-06-05 22:50:18 +00:00
add check
This commit is contained in:
+17
-1
@@ -1,4 +1,4 @@
|
||||
from pyexpat import model
|
||||
import pytest
|
||||
import openai
|
||||
from pydantic import BaseModel
|
||||
from instructor.distil import (
|
||||
@@ -19,6 +19,22 @@ class SimpleModel(BaseModel):
|
||||
data: int
|
||||
|
||||
|
||||
def test_must_have_hint():
|
||||
with pytest.raises(AssertionError):
|
||||
|
||||
@instructions.distil
|
||||
def test_func(x: int):
|
||||
return SimpleModel(data=x)
|
||||
|
||||
|
||||
def test_must_be_base_model():
|
||||
with pytest.raises(AssertionError):
|
||||
|
||||
@instructions.distil
|
||||
def test_func(x) -> int:
|
||||
return SimpleModel(data=x)
|
||||
|
||||
|
||||
def test_is_return_type_base_model_or_instance():
|
||||
def valid_function() -> SimpleModel:
|
||||
return SimpleModel(data=1)
|
||||
|
||||
Reference in New Issue
Block a user