test: add tests for sys, html and time stdlib modules#258
Merged
Conversation
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>
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>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 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:
test/TestSys.fsFable.Python.Sysplatform,version,maxsize,maxunicode,path,argv,byteordertest/TestHtml.fsFable.Python.Htmlescape(default),escape(quote flag),unescape, roundtriptest/TestTime.fsFable.Python.Timetime,monotonic,perf_counter,process_time,ctime,sleep,timezoneMotivation
The
sys,html, andtimemodules all had complete binding files undersrc/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,byteorderislittleorbig).html: Assert escape/unescape produce correct output, including thequoteflag variant and a full roundtrip.time: Assert clock functions return positive/non-negative floats,sleepdoesn't throw, andctimereturns a non-empty string. Uses monotonicity oftime.monotonicfor sequencing.Checklist
test/Fable.Python.Test.fsproj[<Fact>]+equalpattern used throughout the suite