Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion blockkit/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3021,7 +3021,9 @@ def fields(self, *fields: str | Text) -> Self:
)

def add_field(self, field: str | Text) -> Self:
return self._add_field_value("fields", field) # type: ignore[attr-defined]
return self._add_field_value(
"fields", Text(field) if isinstance(field, str) else field
) # type: ignore[attr-defined]

def accessory(self, accessory: SectionElement | None) -> Self:
return self._add_field(
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ Issues = "https://github.com/imryche/blockkit/issues"

[tool.ruff]
line-length = 88
extend-select = ["I", "UP", "ASYNC"]
extend-ignore = ["UP007"]

[tool.ruff.lint]
extend-select = ["I", "UP", "E501", "ASYNC"]
extend-ignore = ["UP007"]

[dependency-groups]
dev = [
Expand Down
3 changes: 3 additions & 0 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3292,6 +3292,9 @@ def test_builds_fields(self):
)
assert got == want

got = Section().add_field("Eat me").add_field("Drink me").build()
assert got == want


class TestTable:
def test_builds(self):
Expand Down
Loading