Refactoring test_float_field
This commit is contained in:
		@@ -101,7 +101,7 @@ class ModelTestCase:
 | 
				
			|||||||
            )
 | 
					            )
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _test_float_field(self, field_name, min_value=None, max_value=None, must_have={}, must_hot_have={}):
 | 
					    def assertFloatField(self, field_name, min_value=None, max_value=None, must_have={}, must_hot_have={}):
 | 
				
			||||||
        '''
 | 
					        '''
 | 
				
			||||||
        Tests if the field is a floatfield. If min_value and/or max_value are passed,
 | 
					        Tests if the field is a floatfield. If min_value and/or max_value are passed,
 | 
				
			||||||
        the validators of the field are also checked. The validator list of the field should
 | 
					        the validators of the field are also checked. The validator list of the field should
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,14 +30,14 @@ class MapablePointTestCase(ModelTestCase, TestCase):
 | 
				
			|||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_latitude(self):
 | 
					    def test_latitude(self):
 | 
				
			||||||
        self._test_float_field(
 | 
					        self.assertFloatField(
 | 
				
			||||||
            field_name='latitude',
 | 
					            field_name='latitude',
 | 
				
			||||||
            min_value=-90,
 | 
					            min_value=-90,
 | 
				
			||||||
            max_value=90
 | 
					            max_value=90
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_longitude(self):
 | 
					    def test_longitude(self):
 | 
				
			||||||
        self._test_float_field(
 | 
					        self.assertFloatField(
 | 
				
			||||||
            field_name='longitude',
 | 
					            field_name='longitude',
 | 
				
			||||||
            min_value=-180,
 | 
					            min_value=-180,
 | 
				
			||||||
            max_value=180
 | 
					            max_value=180
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user