mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
		
			
				
	
	
		
			22 lines
		
	
	
		
			672 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			672 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from django.db import models
 | |
| from django.db.backends.base.schema import BaseDatabaseSchemaEditor
 | |
| from django.test import SimpleTestCase
 | |
| 
 | |
| 
 | |
| class SchemaEditorTests(SimpleTestCase):
 | |
|     def test_effective_default_callable(self):
 | |
|         """
 | |
|         SchemaEditor.effective_default() shouldn't call callable defaults.
 | |
|         """
 | |
| 
 | |
|         class MyStr(str):
 | |
|             def __call__(self):
 | |
|                 return self
 | |
| 
 | |
|         class MyCharField(models.CharField):
 | |
|             def _get_default(self):
 | |
|                 return self.default
 | |
| 
 | |
|         field = MyCharField(max_length=1, default=MyStr)
 | |
|         self.assertEqual(BaseDatabaseSchemaEditor._effective_default(field), MyStr)
 |