Browse Source

🎨 [pre-commit.ci] Auto format from pre-commit.com hooks

pull/14060/head
pre-commit-ci[bot] 11 months ago
parent
commit
a33a980e47
  1. 7
      tests/test_color_compat.py

7
tests/test_color_compat.py

@ -1,4 +1,5 @@
import warnings
import pydantic
try:
@ -6,12 +7,16 @@ try:
except ImportError:
from pydantic.color import Color # triggers DeprecationWarning on v1
class Model(pydantic.BaseModel):
c: Color
def test_color_deprecation_warning():
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
m = Model(c="#FF0000")
dep_warnings = [warn for warn in w if issubclass(warn.category, DeprecationWarning)]
dep_warnings = [
warn for warn in w if issubclass(warn.category, DeprecationWarning)
]
assert len(dep_warnings) == 0, "DeprecationWarning raised! Fixed in this PR"

Loading…
Cancel
Save