Skip to content

Add exception-raising copy dunders via reusable decorator #2076

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 11 commits into from
Apr 26, 2024

Conversation

pushfoo
Copy link
Member

@pushfoo pushfoo commented Apr 26, 2024

TL;DR: Use decorator to stub __copy__ and __deepcopy__ per #2074 + add a bunch of tests

Changes

  1. Add decorator which adds stubs with informative messages

  2. Apply it to the following + add tests:

    • SpriteList
    • BasicSprite + tests for subclasses:
      • Sprite
      • SpriteSolidColor
      • SpriteCircle
    • ShapeElementList and Shape
  3. Apply the decorator to the base UIWidget

    • This should cover all child widgets
    • Tests omitted since adding / removing the decorator as needed is fast and easy
    • It seems unlikely that people will be trying to copy widgets

@pushfoo pushfoo changed the title Add exception-raising BasicSprite copy dunders Add exception-raising copy dunders via reusable decorator Apr 26, 2024
@pushfoo pushfoo force-pushed the add_copy_dunder_stubs branch from 02731f8 to c0ea5ed Compare April 26, 2024 06:34
@einarf
Copy link
Member

einarf commented Apr 26, 2024

👍

@einarf einarf merged commit 0df89b2 into pythonarcade:development Apr 26, 2024
8 checks passed
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.

3 participants