• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

source-academy / py-slang / 37129178683
86%

Build:
DEFAULT BRANCH: main
Ran 03 Oct 2026 02:34PM UTC
Jobs 1
Files 145
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

03 Oct 2026 02:19PM UTC coverage: 85.726%. Remained the same
37129178683

push

github

web-flow
WASM: if/elif and conditional expressions require a strict bool condition (#466)

Every spec doc, under "Conditional statements and conditional
expressions", says: "Following if and elif, Python §x only allows
boolean expressions." A companion PR (#439) already tightened this for
the py2js engine and the substitution-model stepper. WASM's
visitIfStmt/visitTernaryExpr routed the condition through BOOLISE_FX
(the general any-type-truthy helper) instead of CHECK_BOOL_FX (the
strict-bool one and/or's left operand and not already use) -- so
`print(1 if 5 else 2)` silently printed 1 instead of raising a
TypeError.

Fixed using the exact CHECK_BOOL_FX-then-BOOLISE_FX composition
visitBoolOpExpr already uses for and/or's left operand: validate via
CHECK_BOOL_FX first (faults with the existing EXPECTED_BOOL_OPERAND
error if not a bool), then let BOOLISE_FX extract the now-known-bool
truthy value for the wasm `if`. Reuses WASM's existing generic error
message rather than inventing new parametrized wording, matching the
issue's own allowance to follow "WASM's existing error-reporting
conventions."

visitWhileStmt has the identical gap but is deliberately left alone --
out of scope for #437, matching the companion py2js/stepper fix's own
scoping (tracked separately).

Updates the two "if condition uses truthiness" tests and the "ternary
uses truthiness" test in wasm-control-flow.spec.ts (previously pinning
the any-type behavior as expected) to assert EXPECTED_BOOL_OPERAND
instead, matching the established assertion style already used for
and/or/not's identical check in wasm-operators.spec.ts. Also fixes the
CHECK_BOOL_FX doc comment in runtime/operators.ts, which listed "if"
alongside "while" as a BOOLISE_FX-truthiness context -- true before
this change, not after.

Verified: full WASM suite (9 suites, 454 tests) passes; the issue's
own repro (`print(1 if 5 else 2)`) now raises; `while` with a non-bool
condition still runs via truthiness, confirming it's untouche... (continued)

4999 of 6255 branches covered (79.92%)

Branch coverage included in aggregate %.

2 of 2 new or added lines in 1 file covered. (100.0%)

11187 of 12626 relevant lines covered (88.6%)

171987.04 hits per line

Jobs
ID Job ID Ran Files Coverage
1 37129178683.1 03 Oct 2026 02:34PM UTC 145
85.73
GitHub Action Run
Source Files on build 37129178683
  • Tree
  • List 145
  • Changed 2
  • Source Changed 2
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #37129178683
  • 8d7f1b01 on github
  • Prev Build on main (#37127458083)
  • Next Build on main (#37131063698)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc