upgrade pydantic (#266)
* upgrade pydantic Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * update other deps Signed-off-by: Jess Frazelle <github@jessfraz.com> * update other deps Signed-off-by: Jess Frazelle <github@jessfraz.com> * ruff Signed-off-by: Jess Frazelle <github@jessfraz.com> * bump more deps Signed-off-by: Jess Frazelle <github@jessfraz.com> * update Signed-off-by: Jess Frazelle <github@jessfraz.com> * format Signed-off-by: Jess Frazelle <github@jessfraz.com> * bump Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
@ -160,7 +160,7 @@ def test_file_convert_stl():
|
||||
|
||||
# Make sure the bytes are not empty.
|
||||
for key, value in fc.outputs.items():
|
||||
assert len(value.get_decoded()) > 0
|
||||
assert len(value) > 0
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@ -174,13 +174,13 @@ async def test_file_convert_stl_async():
|
||||
file.close()
|
||||
|
||||
# Get the fc.
|
||||
result: Optional[Union[FileConversion, Error]] = (
|
||||
await create_file_conversion.asyncio(
|
||||
client=client,
|
||||
body=content,
|
||||
src_format=FileImportFormat.STL,
|
||||
output_format=FileExportFormat.OBJ,
|
||||
)
|
||||
result: Optional[
|
||||
Union[FileConversion, Error]
|
||||
] = await create_file_conversion.asyncio(
|
||||
client=client,
|
||||
body=content,
|
||||
src_format=FileImportFormat.STL,
|
||||
output_format=FileExportFormat.OBJ,
|
||||
)
|
||||
|
||||
assert isinstance(result, FileConversion)
|
||||
@ -199,7 +199,7 @@ async def test_file_convert_stl_async():
|
||||
|
||||
# Make sure the bytes are not empty.
|
||||
for key, value in fc.outputs.items():
|
||||
assert len(value.get_decoded()) > 0
|
||||
assert len(value) > 0
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@ -213,13 +213,13 @@ async def test_file_convert_obj_async():
|
||||
file.close()
|
||||
|
||||
# Get the fc.
|
||||
result: Optional[Union[FileConversion, Error]] = (
|
||||
await create_file_conversion.asyncio(
|
||||
client=client,
|
||||
body=content,
|
||||
src_format=FileImportFormat.OBJ,
|
||||
output_format=FileExportFormat.STL,
|
||||
)
|
||||
result: Optional[
|
||||
Union[FileConversion, Error]
|
||||
] = await create_file_conversion.asyncio(
|
||||
client=client,
|
||||
body=content,
|
||||
src_format=FileImportFormat.OBJ,
|
||||
output_format=FileExportFormat.STL,
|
||||
)
|
||||
|
||||
assert isinstance(result, FileConversion)
|
||||
@ -238,7 +238,7 @@ async def test_file_convert_obj_async():
|
||||
|
||||
# Make sure the bytes are not empty.
|
||||
for key, value in fc.outputs.items():
|
||||
assert len(value.get_decoded()) > 0
|
||||
assert len(value) > 0
|
||||
|
||||
|
||||
def test_file_mass():
|
||||
@ -508,7 +508,7 @@ def test_ws_import():
|
||||
# Break since now we know it was a success.
|
||||
png_contents = message_dict["resp"]["data"]["modeling_response"][
|
||||
"data"
|
||||
]["contents"].get_decoded()
|
||||
]["contents"]
|
||||
break
|
||||
|
||||
# Save the contents to a file.
|
||||
@ -534,7 +534,27 @@ def test_serialize_deserialize():
|
||||
assert model_dump["request_id"] == "16a06065-6ca3-4a96-a042-d0bec6b161a6" # type: ignore
|
||||
assert model_dump["resp"]["type"] == "modeling" # type: ignore
|
||||
assert model_dump["resp"]["data"]["modeling_response"]["type"] == "import_files" # type: ignore
|
||||
assert model_dump["resp"]["data"]["modeling_response"]["data"]["object_id"] == "f61ac02e-77bd-468f-858f-fd4141a26acd" # type: ignore
|
||||
assert (
|
||||
model_dump["resp"]["data"]["modeling_response"]["data"]["object_id"]
|
||||
== "f61ac02e-77bd-468f-858f-fd4141a26acd"
|
||||
) # type: ignore
|
||||
|
||||
|
||||
def test_deserialize_null_request_id():
|
||||
json_str = """{"success":true,"request_id":null,"resp":{"type":"modeling_session_data","data":{"session":{"api_call_id":"91f7fd17-8846-4593-97ff-6400a81b8cdd"}}}}"""
|
||||
d = json.loads(json_str)
|
||||
print(d)
|
||||
message = WebSocketResponse(**d)
|
||||
model_dump = message.model_dump()
|
||||
print(model_dump)
|
||||
assert model_dump["success"] is True # type: ignore
|
||||
assert model_dump["success"] is True # type: ignore
|
||||
assert model_dump["request_id"] is None # type: ignore
|
||||
assert model_dump["resp"]["type"] == "modeling_session_data" # type: ignore
|
||||
assert (
|
||||
model_dump["resp"]["data"]["session"]["api_call_id"]
|
||||
== "91f7fd17-8846-4593-97ff-6400a81b8cdd"
|
||||
) # type: ignore
|
||||
|
||||
|
||||
def test_text_to_cad():
|
||||
|
Reference in New Issue
Block a user