Skip to content

[py] convert Color to use @classmethod alternative constructors#10558

Merged
titusfortner merged 5 commits intoSeleniumHQ:trunkfrom
symonk:color-alternate-constructor-classmethods
May 9, 2022
Merged

[py] convert Color to use @classmethod alternative constructors#10558
titusfortner merged 5 commits intoSeleniumHQ:trunkfrom
symonk:color-alternate-constructor-classmethods

Conversation

@symonk
Copy link
Copy Markdown
Member

@symonk symonk commented Apr 19, 2022

This patch changes the alternative constructors of the Color class to use the intended @classmethod so the cls is available internally; this allows subclassing without the current static constructors returning instances of the parent class always.. I've moved the color unit tests out of webdriver/support as they are better suited in the test-unit bazel target I think.

The diff here also highlights its a bit of a wild west in terms of linting through /py/ - should we discuss/look at implementing some linting, perhaps https://github.com/psf/black?

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

Merging #10558 (cd0adec) into trunk (669dd62) will increase coverage by 0.04%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##            trunk   #10558      +/-   ##
==========================================
+ Coverage   45.02%   45.07%   +0.04%     
==========================================
  Files          85       85              
  Lines        5508     5513       +5     
  Branches      268      268              
==========================================
+ Hits         2480     2485       +5     
  Misses       2760     2760              
  Partials      268      268              
Impacted Files Coverage Δ
py/selenium/webdriver/support/color.py 98.46% <100.00%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a3d08b1...cd0adec. Read the comment docs.

@titusfortner titusfortner added the C-py Python Bindings label May 9, 2022
@titusfortner titusfortner merged commit 00d8c8d into SeleniumHQ:trunk May 9, 2022
elgatov pushed a commit to elgatov/selenium that referenced this pull request Jun 27, 2022
…eleniumHQ#10558)

* move color tests to unit; change to classmethod constructors to permit subclassing

* remove unnecessary package in support unit tests; fix licensing

* fix  violations in

Co-authored-by: David Burns <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-py Python Bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants