mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Fixed #20440 -- Ensured CharField's max_length/min_length are integers
This commit is contained in:
		
				
					committed by
					
						 Claude Paroz
						Claude Paroz
					
				
			
			
				
	
			
			
			
						parent
						
							0038296135
						
					
				
				
					commit
					caf56ad174
				
			| @@ -125,6 +125,15 @@ class FieldsTests(SimpleTestCase): | ||||
|         self.assertEqual(f.max_length, None) | ||||
|         self.assertEqual(f.min_length, 10) | ||||
|  | ||||
|     def test_charfield_length_not_int(self): | ||||
|         """ | ||||
|         Ensure that setting min_length or max_length to something that is not a | ||||
|         number returns an exception. | ||||
|         """ | ||||
|         self.assertRaises(ValueError, CharField, min_length='a') | ||||
|         self.assertRaises(ValueError, CharField, max_length='a') | ||||
|         self.assertRaises(ValueError, CharField, 'a') | ||||
|  | ||||
|     def test_charfield_widget_attrs(self): | ||||
|         """ | ||||
|         Ensure that CharField.widget_attrs() always returns a dictionary. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user