Skip to content
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

[py] Added Docstrings to RelativeBy Class and Added Missing Deprecation Warning to with_tag_name() #15097

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

shbenzer
Copy link
Contributor

@shbenzer shbenzer commented Jan 16, 2025

User description

Description

Added more detailed docstrings to RelativeBy class
Added missing deprecation warning to with_tag_name()

Motivation and Context

increased documentation, PEP compliance, etc.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

PR Type

Documentation


Description

  • Enhanced docstrings for RelativeBy class and its methods.

  • Added detailed parameter, return, and example sections.

  • Introduced warnings for deprecated methods.

  • Improved clarity and compliance with PEP standards.


Changes walkthrough 📝

Relevant files
Documentation
relative_locator.py
Enhanced docstrings and added examples for `RelativeBy`   

py/selenium/webdriver/support/relative_locator.py

  • Updated docstrings for RelativeBy class and its methods.
  • Added parameter, return, and example sections to methods.
  • Introduced warnings for deprecated methods like with_tag_name.
  • Improved exception handling documentation.
  • +147/-35

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ No major issues detected

    Copy link
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    General
    Improve error message clarity by adding specific validation details

    Add a more descriptive error message for the distance validation in the near()
    method to help users understand the valid range.

    py/selenium/webdriver/support/relative_locator.py [290]

     if distance <= 0:
    +    raise WebDriverException(f"Distance must be greater than 0 pixels, got {distance}")
    • Apply this suggestion
    Suggestion importance[1-10]: 5

    Why: The suggestion improves error handling by providing a more descriptive error message that includes the invalid value, making it easier for developers to diagnose issues. This is a moderate improvement for code maintainability.

    5

    @shbenzer
    Copy link
    Contributor Author

    I also added a deprecation warning that was missing for with_tag_name(). I can remove that and put it in another PR, but that just seems extra

    @shbenzer shbenzer changed the title [py] Added Docstrings to RelativeBy Class [py] Added Docstrings to RelativeBy Class and Added Missing Deprecation Warning to with_tag_name() Jan 16, 2025
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants