Repository: marshmallow-code/marshmallow
Pull request #1784 (2021-04-03 18:48:58)

Update pre-commit config; address flake8 and mypy issues


Patch:
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 8ba7da4f..7ac49e90 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,6 +1,6 @@
 repos:
 - repo: https://github.com/asottile/pyupgrade
-  rev: v2.7.2
+  rev: v2.11.0
   hooks:
   - id: pyupgrade
     args: [--py3-plus]
@@ -10,16 +10,16 @@ repos:
   - id: black
     language_version: python3
 - repo: https://gitlab.com/pycqa/flake8
-  rev: 3.8.3
+  rev: 3.9.0
   hooks:
   - id: flake8
-    additional_dependencies: [flake8-bugbear==20.1.4]
+    additional_dependencies: [flake8-bugbear==21.4.3]
 - repo: https://github.com/pre-commit/mirrors-mypy
-  rev: v0.782
+  rev: v0.812
   hooks:
   - id: mypy
 - repo: https://github.com/asottile/blacken-docs
-  rev: v1.8.0
+  rev: v1.10.0
   hooks:
   - id: blacken-docs
     additional_dependencies: [black==20.8b1]


Test patch:
diff --git a/tests/test_deserialization.py b/tests/test_deserialization.py
index f79ee96e..911cb174 100644
--- a/tests/test_deserialization.py
+++ b/tests/test_deserialization.py
@@ -17,7 +17,7 @@ class TestDeserializingNone:
     @pytest.mark.parametrize("FieldClass", ALL_FIELDS)
     def test_fields_allow_none_deserialize_to_none(self, FieldClass):
         field = FieldClass(allow_none=True)
-        field.deserialize(None) is None
+        assert field.deserialize(None) is None
 
     # https://github.com/marshmallow-code/marshmallow/issues/111
     @pytest.mark.parametrize("FieldClass", ALL_FIELDS)
@@ -29,7 +29,7 @@ class TestDeserializingNone:
     def test_allow_none_is_true_if_missing_is_true(self):
         field = fields.Field(missing=None)
         assert field.allow_none is True
-        field.deserialize(None) is None
+        assert field.deserialize(None) is None
 
     def test_list_field_deserialize_none_to_none(self):
         field = fields.List(fields.String(allow_none=True), allow_none=True)
diff --git a/tests/test_schema.py b/tests/test_schema.py
index 4f5b871c..4428b4f5 100644
--- a/tests/test_schema.py
+++ b/tests/test_schema.py
@@ -2806,7 +2806,7 @@ class TestDefaults:
     def test_loading_none(self, schema, data):
         result = schema.load(data)
         for key in data.keys():
-            result[key] is None
+            assert result[key] is None
 
     def test_missing_inputs_are_excluded_from_load_output(self, schema, data):
         for key in [
diff --git a/tests/test_serialization.py b/tests/test_serialization.py
index a08bbd0a..f0e2b614 100644
--- a/tests/test_serialization.py
+++ b/tests/test_serialization.py
@@ -517,7 +517,7 @@ class TestFieldSerialization:
             name = fields.Field(data_key="")
 
         schema = MySchema()
-        schema.dump({"name": "Grace"}) == {"": "Grace"}
+        assert schema.dump({"name": "Grace"}) == {"": "Grace"}
 
     def test_serialize_with_attribute_and_data_key_uses_data_key(self):
         class ConfusedDumpToAndAttributeSerializer(Schema):
diff --git a/tests/test_utils.py b/tests/test_utils.py
index fff2257f..0a134d1f 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -14,7 +14,7 @@ def test_missing_singleton_copy():
     assert deepcopy(utils.missing) is utils.missing
 
 
-PointNT = namedtuple("Point", ["x", "y"])
+PointNT = namedtuple("PointNT", ["x", "y"])
 
 
 class PointClass:
diff --git a/tests/test_validate.py b/tests/test_validate.py
index 2f120893..461215f9 100644
--- a/tests/test_validate.py
+++ b/tests/test_validate.py
@@ -782,12 +782,12 @@ def test_containsnoneof_error_message():
 
 
 def test_containsnoneof_in_list():
-    validate.ContainsNoneOf([])([]) == []
-    validate.ContainsNoneOf([])([1, 2, 3]) == [1, 2, 3]
-    validate.ContainsNoneOf([4])([1, 2, 3]) == [1, 2, 3]
-    validate.ContainsNoneOf([2])([1, 3, 4]) == [1, 3, 4]
-    validate.ContainsNoneOf([1, 2, 3])([4]) == [4]
-    validate.ContainsNoneOf([4])([1, 1, 1, 1]) == [1]
+    assert validate.ContainsNoneOf([])([]) == []
+    assert validate.ContainsNoneOf([])([1, 2, 3]) == [1, 2, 3]
+    assert validate.ContainsNoneOf([4])([1, 2, 3]) == [1, 2, 3]
+    assert validate.ContainsNoneOf([2])([1, 3, 4]) == [1, 3, 4]
+    assert validate.ContainsNoneOf([1, 2, 3])([4]) == [4]
+    assert validate.ContainsNoneOf([4])([1, 1, 1, 1]) == [1, 1, 1, 1]
 
     with pytest.raises(ValidationError):
         validate.ContainsNoneOf([1])([1, 2, 3])
@@ -828,12 +828,12 @@ def test_containsnoneof_unhashable_types():
 
 
 def test_containsnoneof_in_tuple():
-    validate.ContainsNoneOf(())(()) == ()
-    validate.ContainsNoneOf(())((1, 2, 3)) == (1, 2, 3)
-    validate.ContainsNoneOf((4,))((1, 2, 3)) == (1, 2, 3)
-    validate.ContainsNoneOf((2,))((1, 3, 4)) == (1, 3, 4)
-    validate.ContainsNoneOf((1, 2, 3))((4,)) == (4,)
-    validate.ContainsNoneOf((4,))((1, 1, 1, 1)) == (1,)
+    assert validate.ContainsNoneOf(())(()) == ()
+    assert validate.ContainsNoneOf(())((1, 2, 3)) == (1, 2, 3)
+    assert validate.ContainsNoneOf((4,))((1, 2, 3)) == (1, 2, 3)
+    assert validate.ContainsNoneOf((2,))((1, 3, 4)) == (1, 3, 4)
+    assert validate.ContainsNoneOf((1, 2, 3))((4,)) == (4,)
+    assert validate.ContainsNoneOf((4,))((1, 1, 1, 1)) == (1, 1, 1, 1)
 
     with pytest.raises(ValidationError):
         validate.ContainsNoneOf((1,))((1, 2, 3))
@@ -849,12 +849,12 @@ def test_containsnoneof_in_tuple():
 
 
 def test_containsnoneof_in_string():
-    validate.ContainsNoneOf("")("") == ""
-    validate.ContainsNoneOf("")("abc") == "abc"
-    validate.ContainsNoneOf("d")("abc") == "abc"
-    validate.ContainsNoneOf("b")("acd") == "acd"
-    validate.ContainsNoneOf("abc")("d") == "d"
-    validate.ContainsNoneOf("d")("aaaa") == "a"
+    assert validate.ContainsNoneOf("")("") == ""
+    assert validate.ContainsNoneOf("")("abc") == "abc"
+    assert validate.ContainsNoneOf("d")("abc") == "abc"
+    assert validate.ContainsNoneOf("b")("acd") == "acd"
+    assert validate.ContainsNoneOf("abc")("d") == "d"
+    assert validate.ContainsNoneOf("d")("aaaa") == "aaaa"
 
     with pytest.raises(ValidationError):
         validate.ContainsNoneOf("a")("abc")