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

source-academy / py-slang / 23727466431

30 Mar 2026 04:06AM UTC coverage: 59.421% (+18.2%) from 41.233%
23727466431

push

github

web-flow
Python chapter 2 (+ 3?) support (#81)

* feat: introduce chapter-based CSE evaluators + improve type safety of value type + add stubs for LINKED_LIST group

* add Python Chapter 1 back to the Rollup config

* Turned resolver type-checking back on + fix build_linked_list not working

* Fix bug where groups weren't loading + Make builtins more type-safe + Added native list functions (print_linked_list, head, tail)

* my changes

* Add Python chapter 3 functions + Fix syntax of stream prelude + Add list creation instruction + Make parser variant specific + Add basic tests for standard library

* Fix rounding + add tests for linked lists

* Fixed bug regarding representation of strings (printing ["a", "b"] returned [a, b])

* Mark files as unused (for now)

* Fix test cases

* Added variant to parser in WASM compiler

* Fix linked-list prelude using the old terminology of list + Fix build_linked_list(None) returning None instead of list()

* Add ability to check output from testing framework

* Add documentation for TestCases + add the repr function

* Improve alignment with Python specs + add ability to index lists + move variant checking to the resolver + improve test names + add a lot more tests

* Add more tests for operators + restrict the not operator to only booleans + disallow booleans in the unary minus operator

* FIx print_linked_list not actually printing the linked list

* Implement while loops + unpacking with for loops + implement tuples + break and continue

* Added a public is_linked_list function, added more comprehensive test cases for is_pair and is_linked_list

* extended test cases for linked lists

* Updated to have distinction between linkedlist Value and Python List for ease of future implementation of python list

* Revert "Updated to have distinction between linkedlist Value and Python List for ease of future implementation of python list"

This reverts commit d444793b1.

* fixed and/or operator bu... (continued)

779 of 1553 branches covered (50.16%)

Branch coverage included in aggregate %.

442 of 651 new or added lines in 32 files covered. (67.9%)

17 existing lines in 4 files now uncovered.

2400 of 3797 relevant lines covered (63.21%)

3195.38 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/src/stdlib/stream.ts
1
import { Context } from "../cse-machine/context";
2
import { ControlItem } from "../cse-machine/control";
3
import { BuiltinValue, ListValue, NoneValue, Value } from "../cse-machine/stash";
4
import { Validate } from "../stdlib";
1✔
5
import streamPrelude from "./stream.prelude";
1✔
6
import { Group, GroupName } from "./utils";
1✔
7

8
const streamBuiltins = new Map<string, BuiltinValue>();
1✔
9

10
class StreamBuiltins {
11
  @Validate(0, null, "stream", true)
12
  static stream(
1✔
13
    args: Value[],
14
    source: string,
15
    command: ControlItem,
16
    context: Context,
17
  ): ListValue | NoneValue {
NEW
18
    if (args.length === 0) {
×
NEW
19
      return { type: "none" };
×
20
    }
NEW
21
    const head = args[0];
×
NEW
22
    return {
×
23
      type: "list",
24
      value: [
25
        head,
26
        {
27
          type: "builtin",
28
          name: "anonymous stream",
NEW
29
          func: () => StreamBuiltins.stream(args.slice(1), source, command, context),
×
30
        },
31
      ],
32
    };
33
  }
34
}
35
for (const builtin of Object.getOwnPropertyNames(StreamBuiltins)) {
1✔
36
  if (
4✔
37
    typeof StreamBuiltins[builtin as keyof typeof StreamBuiltins] === "function" &&
5✔
38
    !builtin.startsWith("_")
39
  ) {
40
    streamBuiltins.set(builtin, {
1✔
41
      type: "builtin",
42
      func: StreamBuiltins[builtin as keyof typeof StreamBuiltins] as BuiltinValue["func"],
43
      name: builtin,
44
    });
45
  }
46
}
47
export default {
1✔
48
  name: GroupName.STREAMS,
49
  prelude: streamPrelude,
50
  builtins: streamBuiltins,
51
} as Group;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc