mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-10-31 16:07:38 +03:00 
			
		
		
		
	Merge pull request #651 from fernandogrd/master
DictWithMetadata.__getstate__ was never called (Fix for 645)
This commit is contained in:
		
						commit
						aa03425c09
					
				|  | @ -33,7 +33,7 @@ class DictWithMetadata(dict): | ||||||
|         """ |         """ | ||||||
|         # return an instance of the first dict in MRO that isn't a DictWithMetadata |         # return an instance of the first dict in MRO that isn't a DictWithMetadata | ||||||
|         for base in self.__class__.__mro__: |         for base in self.__class__.__mro__: | ||||||
|             if not isinstance(base, DictWithMetadata) and isinstance(base, dict): |             if not issubclass(base, DictWithMetadata) and issubclass(base, dict): | ||||||
|                 return base(self) |                 return base(self) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -900,6 +900,13 @@ class SerializerPickleTests(TestCase): | ||||||
|                 fields = ('name', 'age') |                 fields = ('name', 'age') | ||||||
|         pickle.dumps(InnerPersonSerializer(Person(name="Noah", age=950)).data) |         pickle.dumps(InnerPersonSerializer(Person(name="Noah", age=950)).data) | ||||||
| 
 | 
 | ||||||
|  |     def test_getstate_method_should_not_return_none(self): | ||||||
|  |         '''Regression test for  | ||||||
|  |         https://github.com/tomchristie/django-rest-framework/issues/645 | ||||||
|  |         ''' | ||||||
|  |         d = serializers.DictWithMetadata({1:1}) | ||||||
|  |         self.assertEqual(d.__getstate__(), serializers.SortedDict({1:1})) | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| class DepthTest(TestCase): | class DepthTest(TestCase): | ||||||
|     def test_implicit_nesting(self): |     def test_implicit_nesting(self): | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user