Skip to content

fix: parse division in free parameter expressions#1258

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

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
Copy link
Copy Markdown

@GodHad GodHad commented May 12, 2026

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
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.

1 participant