コード例 #1
0
 def test_are_valid_params_no_numeric(self):
     rect_params = {
         'min_lat': 'abcd',
         'max_lat': '40.0',
         'min_long': '80.0',
         'max_long': '90.0'
     }
     with self.assertRaises(ValidationError):
         MapObject.get_as_decimals(rect_params)
コード例 #2
0
 def test_are_valid_params_no_numeric(self):
     rect_params = {
         'min_lat': 'abcd',
         'max_lat': '40.0',
         'min_long': '80.0',
         'max_long': '90.0'
     }
     with self.assertRaises(ValidationError):
         MapObject.get_as_decimals(rect_params)
コード例 #3
0
    def test_are_valid_params_incomplete(self):

        rect_params = {
            'min_lat': None,
            'max_lat': '40.0',
            'min_long': '80.0',
            'max_long': '90.0'
        }
        with self.assertRaises(ValidationError):
            MapObject.get_as_decimals(rect_params)
コード例 #4
0
    def test_are_valid_params_incomplete(self):

        rect_params = {
            'min_lat': None,
            'max_lat': '40.0',
            'min_long': '80.0',
            'max_long': '90.0'
        }
        with self.assertRaises(ValidationError):
            MapObject.get_as_decimals(rect_params)
コード例 #5
0
    def test_are_valid_params(self):
        rect_params = {
            'min_lat': '30.0',
            'max_lat': '40.0',
            'min_long': '80.0',
            'max_long': '90.0'
        }

        rect_params_decimals = MapObject.get_as_decimals(rect_params)
        self.assertEqual(rect_params_decimals['min_lat'], 30.0)
        self.assertEqual(rect_params_decimals['max_lat'], 40.0)
        self.assertEqual(rect_params_decimals['min_long'], 80.0)
        self.assertEqual(rect_params_decimals['max_long'], 90.0)
コード例 #6
0
    def test_are_valid_params(self):
        rect_params = {
            'min_lat': '30.0',
            'max_lat': '40.0',
            'min_long': '80.0',
            'max_long': '90.0'
        }

        rect_params_decimals = MapObject.get_as_decimals(rect_params)
        self.assertEqual(rect_params_decimals['min_lat'], 30.0)
        self.assertEqual(rect_params_decimals['max_lat'], 40.0)
        self.assertEqual(rect_params_decimals['min_long'], 80.0)
        self.assertEqual(rect_params_decimals['max_long'], 90.0)