Skip to content

Fix missing Python parameter type defaults #259

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

Merged
merged 3 commits into from
Feb 15, 2024

Conversation

kieran-ryan
Copy link
Member

@kieran-ryan kieran-ryan commented Dec 22, 2023

🤔 What's changed?

The project documentation outlines for Customer Parameter Types that use_for_snippets "Defaults to true" and that prefer_for_regexp_match "Defaults to false".

Although this aligns with the documented Python example, its implementation is missing default values for those keyword arguments:

class ParameterType:
    def __init__(
        self,
        name,
        regexp,
        type,
        transformer,
        use_for_snippets,
        prefer_for_regexp_match,
    ):

With this PR:

  1. The appropriate defaults have been added to the ParameterType class.
  2. Two versions of Python type hints in the module defining that class have been reduced to one e.g. typing.List and list (through__future__.annotations).

⚡️ What's your motivation?

  • Fix a bug where default keyword arguments were not set for customer parameter types in Python
  • Remove invalid documentation that alternatives can not be escaped

🏷️ What kind of change is this?

  • 🐛 Bug fix (non-breaking change which fixes a defect)

♻️ Anything particular you want feedback on?

Whether small correction to alternatives in README.md is appropriate.

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

@kieran-ryan kieran-ryan force-pushed the fix-python-param-defaults branch 5 times, most recently from 5f74f1f to 87a35bd Compare December 27, 2023 15:42
@kieran-ryan kieran-ryan marked this pull request as ready for review December 27, 2023 18:06
@kieran-ryan kieran-ryan force-pushed the fix-python-param-defaults branch from 87a35bd to 4cd03a0 Compare December 27, 2023 18:06
@kieran-ryan kieran-ryan self-assigned this Dec 27, 2023
Copy link
Contributor

@mpkorstanje mpkorstanje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this PR makes more changes then it says in the title. Fixing the defaults would have been an automatic merge, the other stuff needs some consideration.

@kieran-ryan kieran-ryan force-pushed the fix-python-param-defaults branch from 4cd03a0 to 23d4e88 Compare February 12, 2024 23:13
@kieran-ryan
Copy link
Member Author

Appreciate the considered feedback @mpkorstanje - refined PR scope accordingly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Defect / Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants