Repository navigation
fix: resolve issue #18 - Good first issue: property-based tests for the proof validator #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| from hypothesis import given, strategies as st | ||
| import fable_v2.proof_engine as pe | ||
|
|
||
| @given(st.text(alphabet=st.characters(blacklist_categories=('C', 'Mn', 'Pc')), min_size=1, max_size=100), | ||
| st.lists(st.text(alphabet=st.characters(blacklist_categories=('C', 'Mn', 'Pc')), min_size=1, max_size=100), min_size=1, max_size=10)) | ||
| def test_boundary_inputs(code_snippet, variable_names): | ||
| # Generate boundary inputs | ||
| boundary_input = f"{code_snippet} ; {'; '.join(variable_names)}" | ||
| result = pe.validate_invariants(boundary_input) | ||
| assert isinstance(result, bool) | ||
|
|
||
| @given(st.recursive(st.text(alphabet=st.characters(blacklist_categories=('C', 'Mn', 'Pc')), min_size=1, max_size=10), lambda x: st.lists(x, min_size=1, max_size=3), max_depth=5)) | ||
| def test_deeply_nested_ast(nested_ast): | ||
| # Generate deeply nested ASTs | ||
| result = pe.validate_invariants(nested_ast) | ||
| assert isinstance(result, bool) | ||
|
|
||
| @given(st.text(alphabet=st.characters(blacklist_categories=('C', 'Mn', 'Pc')), min_size=1, max_size=100)) | ||
| def test_unicode_identifiers(unicode_code_snippet): | ||
| # Generate code snippets with unicode identifiers | ||
| result = pe.validate_invariants(unicode_code_snippet) | ||
| assert isinstance(result, bool) | ||
|
|
||
| @given(st.text(alphabet=st.characters(blacklist_categories=('C', 'Mn', 'Pc')), min_size=1, max_size=100)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Exercise the empty string in
🤖 Prompt for AI Agents |
||
| def test_empty_input(empty_code_snippet): | ||
| # Test with empty input | ||
| result = pe.validate_invariants(empty_code_snippet) | ||
| assert isinstance(result, bool) | ||
|
|
||
| @given(st.text(alphabet=st.characters(blacklist_categories=('C', 'Mn', 'Pc')), min_size=1, max_size=100)) | ||
| def test_tautology_variants(tautology_code_snippet): | ||
| # Test with tautology variants | ||
| tautology_forms = [ | ||
| f"({tautology_code_snippet}) -> ({tautology_code_snippet})", | ||
| f"({tautology_code_snippet}) -> {tautology_code_snippet}", | ||
| f"{tautology_code_snippet} -> ({tautology_code_snippet})" | ||
| ] | ||
| for form in tautology_forms: | ||
| result = pe.validate_invariants(form) | ||
| assert isinstance(result, bool) | ||
|
Comment on lines
+1
to
+40
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Run The test matrix runs 🤖 Prompt for AI Agents
Comment on lines
+13
to
+40
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Call the exposed validator API. The added tests import 🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Declare and install Hypothesis for tests.
fable_v2/tests/test_proof_engine.pyimportshypothesisduring collection, but the project declares no test dependency and the documented setup installs only the editable package andpytest. A clean environment can therefore fail withModuleNotFoundError. Add Hypothesis to a test dependency group, then install that group in CI and the documented test setup, for example withpip install -e ".[test]" pytest.🤖 Prompt for AI Agents