Skip to content

test: add tests for sys, html and time stdlib modules#258

Merged
dbrattli merged 3 commits intomainfrom
repo-assist/tests-sys-html-time-2026-04-18-60a642646bf518c7
Apr 18, 2026
Merged

test: add tests for sys, html and time stdlib modules#258
dbrattli merged 3 commits intomainfrom
repo-assist/tests-sys-html-time-2026-04-18-60a642646bf518c7

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 This is an automated pull request from Repo Assist, an AI assistant for this repository.

Summary

Adds test coverage for three stdlib modules that had bindings but no test files:

New Test File Module Tests Added
test/TestSys.fs Fable.Python.Sys platform, version, maxsize, maxunicode, path, argv, byteorder
test/TestHtml.fs Fable.Python.Html escape (default), escape (quote flag), unescape, roundtrip
test/TestTime.fs Fable.Python.Time time, monotonic, perf_counter, process_time, ctime, sleep, timezone

Motivation

The sys, html, and time modules all had complete binding files under src/stdlib/ but were absent from the test suite. This meant regressions in those bindings could go undetected.

Test strategy

  • sys: Assert properties have expected types and sensible values (e.g., maxunicode == 1114111, byteorder is little or big).
  • html: Assert escape/unescape produce correct output, including the quote flag variant and a full roundtrip.
  • time: Assert clock functions return positive/non-negative floats, sleep doesn't throw, and ctime returns a non-empty string. Uses monotonicity of time.monotonic for sequencing.

Checklist

  • New test files registered in test/Fable.Python.Test.fsproj
  • Tests follow the existing [<Fact>] + equal pattern used throughout the suite
  • CI validates the build and Python test run

Generated by Repo Assist · ● 2M ·

Add test coverage for three stdlib modules that had bindings
but no tests:
- TestSys.fs: platform, version, maxsize, maxunicode, path, argv, byteorder
- TestHtml.fs: escape (with/without quote flag), unescape, roundtrip
- TestTime.fs: time, monotonic, perf_counter, process_time, ctime, sleep, timezone

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove trivially-true Count >= 0 assertions; assert argv/path are non-empty instead
- Drop redundant |> ignore no-ops
- Remove sys.maxsize test — binding types it as int (Int32) but Python
  value overflows on 64-bit systems, so comparison returns False
- Simplify time.sleep test to just call sleep (no-op assertion removed)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dbrattli dbrattli marked this pull request as ready for review April 18, 2026 04:47
Python's sys.maxsize is 2^63−1 on 64-bit systems, which overflows Fable's
Int32 (the target type for F# int). nativeint maps to Python's native int,
preserving the full value. Re-adds the maxsize positivity test.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dbrattli dbrattli changed the title [Repo Assist] test: add tests for sys, html and time stdlib modules test: add tests for sys, html and time stdlib modules Apr 18, 2026
@dbrattli dbrattli merged commit 3309786 into main Apr 18, 2026
9 of 10 checks passed
@dbrattli dbrattli deleted the repo-assist/tests-sys-html-time-2026-04-18-60a642646bf518c7 branch April 18, 2026 04:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant