Skip to content

fix: parse division in free parameter expressions#1258

Closed
GodHad wants to merge 1 commit into
amazon-braket:mainfrom
GodHad:fix/free-parameter-expression-division
Closed

fix: parse division in free parameter expressions#1258
GodHad wants to merge 1 commit into
amazon-braket:mainfrom
GodHad:fix/free-parameter-expression-division

Conversation

@GodHad

@GodHad GodHad commented May 12, 2026

Copy link
Copy Markdown

Issue #1251

Description of changes:

  • Adds support for parsing / in FreeParameterExpression string constructors by mapping ast.Div to the existing true-division implementation.
  • Updates the parameter expression unit tests so FreeParameterExpression("theta/alpha") matches the equivalent expression built with FreeParameter("theta") / FreeParameter("alpha").
  • Keeps unsupported division-like operations, such as //, covered by the unsupported binary operation test.

Testing done:

  • python -m pytest -o addopts='' test\unit_tests\braket\parametric\test_free_parameter_expression.py
  • Result: 27 passed, 4 xfailed

Merge Checklist

General

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have checked that my tests are not configured for a specific region or account (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@GodHad GodHad requested a review from a team as a code owner May 12, 2026 14:50
@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (e4274ea) to head (c577a24).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1258   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          169       169           
  Lines        10961     10961           
  Branches      1412      1412           
=========================================
  Hits         10961     10961           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nilsquet

nilsquet commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Hi @GodHad, thanks for the contribution! We ended up merging #1271 for this issue, but your effort here is genuinely appreciated.

@nilsquet nilsquet closed this Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants