def test_multilinestring_validation(self):
        class Location(Document):
            loc = MultiLineStringField()

        invalid_coords = {"x": 1, "y": 2}
        expected = 'MultiLineStringField 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 = 'MultiLineStringField type must be "MultiLineString"'
        self._test_for_expected_error(Location, invalid_coords, expected)

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

        invalid_coords = [5, "a"]
        expected = "Invalid MultiLineString must contain at least one valid linestring"
        self._test_for_expected_error(Location, invalid_coords, expected)

        invalid_coords = [[[1]]]
        expected = "Invalid MultiLineString:\nValue (%s) must be a two-dimensional point" % repr(invalid_coords[0][0])
        self._test_for_expected_error(Location, invalid_coords, expected)

        invalid_coords = [[[1, 2, 3]]]
        expected = "Invalid MultiLineString:\nValue (%s) must be a two-dimensional point" % repr(invalid_coords[0][0])
        self._test_for_expected_error(Location, invalid_coords, expected)

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

        Location(loc=[[[1, 2], [3, 4], [5, 6], [1, 2]]]).validate()
dataset/ETHPy150Open MongoEngine/mongoengine/tests/fields/geo.py/GeoFieldTest.test_multilinestring_validation/original