Skip to content

Commit fc2f96c

Browse files
committed
fix: mixin bool check
1 parent 5405a38 commit fc2f96c

File tree

6 files changed

+35
-5
lines changed

6 files changed

+35
-5
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "avrae-ls"
7-
version = "0.8.2"
7+
version = "0.8.3"
88
description = "Language server for Avrae draconic aliases"
99
authors = [
1010
{ name = "1drturtle" }

src/avrae_ls/runtime/api.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ def __iter__(self) -> Iterator[None]:
5353
def __len__(self) -> int:
5454
return 0
5555

56+
def __bool__(self) -> bool:
57+
# These API wrappers are objects, not containers. They may intentionally present
58+
# as empty iterables to draconic (for safety), but should still be truthy.
59+
return True
60+
5661

5762
class SimpleRollResult(_DirMixin):
5863
ATTRS: ClassVar[list[str]] = ["dice", "total", "full", "result", "raw"]

tests/test_alias_tests.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,31 @@ async def test_alias_tests_allow_metadata_character_override(tmp_path):
316316
assert result.actual == "Tester"
317317

318318

319+
@pytest.mark.asyncio
320+
async def test_alias_tests_character_override_makes_character_truthy(tmp_path):
321+
alias_path = tmp_path / "haschar.alias"
322+
alias_path.write_text(
323+
"!alias haschar echo <drac2>\n"
324+
"ch = character()\n"
325+
"if not ch:\n"
326+
" return \"bad output\"\n"
327+
"return \"good output\"\n"
328+
"</drac2>"
329+
)
330+
test_path = tmp_path / "test-haschar.alias-test"
331+
test_path.write_text("!haschar\n---\ngood output\n---\ncharacter:\n name: Tester\n")
332+
333+
config = AvraeLSConfig.default(tmp_path)
334+
builder = ContextBuilder(config)
335+
executor = MockExecutor(config.service)
336+
337+
case = parse_alias_tests(test_path)[0]
338+
result = (await run_alias_tests([case], builder, executor))[0]
339+
340+
assert result.passed
341+
assert result.actual == "good output"
342+
343+
319344
@pytest.mark.asyncio
320345
async def test_alias_tests_allow_metadata_vars_override(tmp_path):
321346
alias_path = tmp_path / "hp.alias"

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vscode-extension/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vscode-extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "avrae-ls-client",
33
"displayName": "Avrae Draconic Alias Language Server",
44
"description": "VS Code client for avrae-ls (draconic alias diagnostics and mock execution).",
5-
"version": "0.8.2",
5+
"version": "0.8.3",
66
"engines": {
77
"vscode": "^1.84.0"
88
},

0 commit comments

Comments
 (0)