def test_multipoint_validation(self):
        class Location(Document):
            loc = MultiPointField()

        invalid_coords = {"x": 1, "y": 2}
        expected = 'MultiPointField can only accept a valid GeoJson dictionary or lists of (x, y)'
        self._test_for_expected_error(Location, invalid_coords, expected)

        invalid_coords = {"type": "MadeUp", "coordinates": [[]]}
        expected = 'MultiPointField type must be "MultiPoint"'
        self._test_for_expected_error(Location, invalid_coords, expected)

        invalid_coords = {"type": "MultiPoint", "coordinates": [[1, 2, 3]]}
        expected = "Value ([1, 2, 3]) must be a two-dimensional point"
        self._test_for_expected_error(Location, invalid_coords, expected)

        invalid_coords = [[]]
        expected = "Invalid MultiPoint must contain at least one valid point"
        self._test_for_expected_error(Location, invalid_coords, expected)

        invalid_coords = [[[1]], [[1, 2, 3]]]
        for coord in invalid_coords:
            expected = "Value (%s) must be a two-dimensional point" % repr(coord[0])
            self._test_for_expected_error(Location, coord, expected)

        invalid_coords = [[[{}, {}]], [("a", "b")]]
        for coord in invalid_coords:
            expected = "Both values (%s) in point must be float or int" % repr(coord[0])
            self._test_for_expected_error(Location, coord, expected)

        Location(loc=[[1, 2]]).validate()
        Location(loc={
            "type": "MultiPoint",
            "coordinates": [
                [1, 2],
                [81.4471435546875, 23.61432859499169]
            ]}).validate()
dataset/ETHPy150Open MongoEngine/mongoengine/tests/fields/geo.py/GeoFieldTest.test_multipoint_validation/original