mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Refs #35987 -- Added extra tests for ErrorList and ErrorDict copy methods.
This commit is contained in:
		
				
					committed by
					
						
						Sarah Boyce
					
				
			
			
				
	
			
			
			
						parent
						
							4806c42efa
						
					
				
				
					commit
					5e998d717f
				
			@@ -162,6 +162,24 @@ class FormsUtilsTestCase(SimpleTestCase):
 | 
				
			|||||||
            '<a href="http://www.example.com/">example</a></li></ul>',
 | 
					            '<a href="http://www.example.com/">example</a></li></ul>',
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def test_error_list_copy(self):
 | 
				
			||||||
 | 
					        e = ErrorList(
 | 
				
			||||||
 | 
					            [
 | 
				
			||||||
 | 
					                ValidationError(
 | 
				
			||||||
 | 
					                    message="message %(i)s",
 | 
				
			||||||
 | 
					                    params={"i": 1},
 | 
				
			||||||
 | 
					                ),
 | 
				
			||||||
 | 
					                ValidationError(
 | 
				
			||||||
 | 
					                    message="message %(i)s",
 | 
				
			||||||
 | 
					                    params={"i": 2},
 | 
				
			||||||
 | 
					                ),
 | 
				
			||||||
 | 
					            ]
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        e_copy = copy.copy(e)
 | 
				
			||||||
 | 
					        self.assertEqual(e, e_copy)
 | 
				
			||||||
 | 
					        self.assertEqual(e.as_data(), e_copy.as_data())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_error_list_copy_attributes(self):
 | 
					    def test_error_list_copy_attributes(self):
 | 
				
			||||||
        class CustomRenderer(DjangoTemplates):
 | 
					        class CustomRenderer(DjangoTemplates):
 | 
				
			||||||
            pass
 | 
					            pass
 | 
				
			||||||
@@ -195,6 +213,16 @@ class FormsUtilsTestCase(SimpleTestCase):
 | 
				
			|||||||
        e_deepcopy = copy.deepcopy(e)
 | 
					        e_deepcopy = copy.deepcopy(e)
 | 
				
			||||||
        self.assertEqual(e, e_deepcopy)
 | 
					        self.assertEqual(e, e_deepcopy)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def test_error_dict_copy_attributes(self):
 | 
				
			||||||
 | 
					        class CustomRenderer(DjangoTemplates):
 | 
				
			||||||
 | 
					            pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        renderer = CustomRenderer()
 | 
				
			||||||
 | 
					        e = ErrorDict(renderer=renderer)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        e_copy = copy.copy(e)
 | 
				
			||||||
 | 
					        self.assertEqual(e.renderer, e_copy.renderer)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_error_dict_html_safe(self):
 | 
					    def test_error_dict_html_safe(self):
 | 
				
			||||||
        e = ErrorDict()
 | 
					        e = ErrorDict()
 | 
				
			||||||
        e["username"] = "Invalid username."
 | 
					        e["username"] = "Invalid username."
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user