From d70b044157e258365868a32daeff4b158b1fbc9d Mon Sep 17 00:00:00 2001 From: Ross MacArthur Date: Thu, 5 Mar 2020 23:28:11 +0200 Subject: [PATCH] Remove deprecated `Constant` field --- RELEASES.rst | 6 ++++-- src/serde/fields.py | 12 ------------ tests/test_fields.py | 9 --------- 3 files changed, 4 insertions(+), 23 deletions(-) diff --git a/RELEASES.rst b/RELEASES.rst index 4a8f095..2fcc498 100644 --- a/RELEASES.rst +++ b/RELEASES.rst @@ -6,7 +6,8 @@ Releases *Unreleased* -- Improve ``ValidationError`` messages for container fields. +- Remove deprecated ``Constant`` field. +- Improve ``ValidationError`` messages for container fields. (`7746732`_) - Rename ``BaseField`` to ``_Base``. (`c5abc2f`_) - Add ``frozenset`` to FIELD_CLASS_MAP. (`24d7c0e`_) - Add ``Flatten`` field. (`9c740a5`_) @@ -17,7 +18,6 @@ Releases - Completely rework error handling. (`c95b6b3`_) - Make ``Tag.lookup_tag`` default to module + qualname. (`26963d6`_) -.. _c5abc2f: https://github.com/rossmacarthur/serde/commit/c5abc2f1d36e9c0857dc1ea65e4536be4c7397ef .. _26963d6: https://github.com/rossmacarthur/serde/commit/26963d65b45229db50444665a3160bd0f1358421 .. _c95b6b3: https://github.com/rossmacarthur/serde/commit/c95b6b329125164e3301a7e43292c7a858d5e34f .. _2a54886: https://github.com/rossmacarthur/serde/commit/2a548865106b1cfc98f5dea8bf00084f62e6334e @@ -26,6 +26,8 @@ Releases .. _34783b0: https://github.com/rossmacarthur/serde/commit/34783b03084acffc1fd1cddf4c987d3855d45330 .. _9c740a5: https://github.com/rossmacarthur/serde/commit/9c740a5e9f40b1d913f2d718947f7204e87c6ffa .. _24d7c0e: https://github.com/rossmacarthur/serde/commit/24d7c0e3320226837586b214ad3dfc0d95852ddb +.. _c5abc2f: https://github.com/rossmacarthur/serde/commit/c5abc2f1d36e9c0857dc1ea65e4536be4c7397ef +.. _7746732: https://github.com/rossmacarthur/serde/commit/7746732d2180d6bd9cbf141475f87409b7977343 0.7.3 ----- diff --git a/src/serde/fields.py b/src/serde/fields.py index 421251a..11cc427 100644 --- a/src/serde/fields.py +++ b/src/serde/fields.py @@ -912,18 +912,6 @@ def validate(self, value): ) -class Constant(Literal): - """ - Deprecated, use `Literal`. - """ - - def __init__(self, value, **kwargs): - """ - Create a new `Constant`. - """ - super(Constant, self).__init__(value, **kwargs) - - class Choice(Field): """ One of a given selection of values. diff --git a/tests/test_fields.py b/tests/test_fields.py index f96b801..954168e 100644 --- a/tests/test_fields.py +++ b/tests/test_fields.py @@ -13,7 +13,6 @@ Bytes, Choice, Complex, - Constant, Date, DateTime, Deque, @@ -1203,14 +1202,6 @@ def test_validate(self): assert field.validate(False) -class TestConstant: - def test___init__(self): - # Construct a basic Constant and check values are set correctly. - field = Constant(1) - assert field.value == 1 - assert field.validators == [] - - class TestChoice: def test___init__(self): # Construct a basic Choice and check values are set correctly.