From 3421b4bd971bb3ee6467fcaa1be89f7c7062fb85 Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Sat, 2 Feb 2019 14:36:56 +0100 Subject: [PATCH] Split test and fix warning message is deprecated. --- tests/test_dunders.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/tests/test_dunders.py b/tests/test_dunders.py index 468a56982..b9337b2eb 100644 --- a/tests/test_dunders.py +++ b/tests/test_dunders.py @@ -496,17 +496,20 @@ def assert_hash_code_not_cached_across_serialization(original): HashCacheSerializationTestCachedSlots() ) - # Test that a custom __setstate__ is disallowed on a - # cache_hash=True object. - # This is needed because we handle clearing the cache after - # deserialization with a custom __setstate__. It is possible - # to make both work, but it requires some thought about how to go - # about it, so it has not yet been implemented. + def test_caching_and_custom_setstate(self): + """ + The combination of a custom __setstate__ and cache_hash=True is caught + with a helpful message. + + This is needed because we handle clearing the cache after + deserialization with a custom __setstate__. It is possible to make both + work, but it requires some thought about how to go about it, so it has + not yet been implemented. + """ with pytest.raises( NotImplementedError, - message="Currently you cannot use hash caching if you " - "specify your own __setstate__ method. This is tracked" - "by https://github.com/python-attrs/attrs/issues/494", + match="Currently you cannot use hash caching if you " + "specify your own __setstate__ method.", ): @attr.attrs(hash=True, cache_hash=True)