Add firstindex and lastindex support for GeoJSON types to enable x[begin]/x[end] indexing#115
Add firstindex and lastindex support for GeoJSON types to enable x[begin]/x[end] indexing#115
Conversation
Co-authored-by: asinghvi17 <32143268+asinghvi17@users.noreply.github.com>
asinghvi17
left a comment
There was a problem hiding this comment.
@copilot add a test, otherwise looks good
Co-authored-by: asinghvi17 <32143268+asinghvi17@users.noreply.github.com>
Added comprehensive tests for Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot include similar tests for lastindex where you test fistindex Lol it doesn't listen to me |
Co-authored-by: asinghvi17 <32143268+asinghvi17@users.noreply.github.com>
Added comprehensive tests for
Added comprehensive tests for Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
OMG @copilot please do the tests using the same test objects and setup for both |
This PR adds complete indexing support for GeoJSON types by implementing
firstindexmethods and adding comprehensive tests for bothfirstindexandlastindexfunctionality.Problem Solved
Before this change, GeoJSON types only supported
endindexing but notbeginindexing:After this change, both
beginandendindexing work correctly:Implementation
Added
firstindexmethods insrc/geojson_types.jl:Base.firstindex(g::AbstractGeometry) = 1- covers Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygonBase.firstindex(g::GeometryCollection) = 1- covers GeometryCollectionBase.firstindex(fc::AbstractFeatureCollection) = 1- covers FeatureCollection and LazyFeatureCollectionAdded comprehensive tests in
test/runtests.jl:firstindex(obj) == 1andobj[begin] == obj[1]for all indexable typeslastindex(obj) == length(obj)andobj[end] == obj[lastindex(obj)]for all indexable typesAll tests pass, confirming the implementation works correctly for both indexing directions.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.