From 9c06ca83a1af1ccf92cc92b46bdacfea0ddafe09 Mon Sep 17 00:00:00 2001 From: Guillaume Aquilina Date: Wed, 16 Oct 2024 13:02:10 -0400 Subject: [PATCH] fix: export File field --- pyproject.toml | 2 +- workflowai/fields.py | 1 + workflowai/fields_test.py | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 workflowai/fields_test.py diff --git a/pyproject.toml b/pyproject.toml index 9024caf..f73edd5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "workflowai" -version = "0.3.3" +version = "0.3.4" description = "" authors = ["Guillaume Aquilina "] readme = "README.md" diff --git a/workflowai/fields.py b/workflowai/fields.py index d3c8769..ddbb632 100644 --- a/workflowai/fields.py +++ b/workflowai/fields.py @@ -1,5 +1,6 @@ from workflowai.core.fields.chat_message import ChatMessage as ChatMessage from workflowai.core.fields.email_address import EmailAddressStr as EmailAddressStr +from workflowai.core.fields.file import File as File from workflowai.core.fields.html_string import HTMLString as HTMLString from workflowai.core.fields.http_url import HttpUrl as HttpUrl from workflowai.core.fields.image import Image as Image diff --git a/workflowai/fields_test.py b/workflowai/fields_test.py new file mode 100644 index 0000000..10bdd3c --- /dev/null +++ b/workflowai/fields_test.py @@ -0,0 +1,18 @@ +import os + +from workflowai import fields + + +def test_exported_fields_match_core_fields(): + # Get the number of exported fields in fields.py + exported_fields = {attr for attr in dir(fields) if not attr.startswith("_")} + + # Get the number of files in workflowai/core/fields + core_fields_dir = os.path.join(os.path.dirname(__file__), "core", "fields") + core_field_files = { + "".join(word.capitalize() for word in f.removesuffix(".py").split("_")) + for f in os.listdir(core_fields_dir) + if f.endswith(".py") and f != "__init__.py" and not f.endswith("_test.py") + } + + assert len(core_field_files) == len(exported_fields)