Skip to content

Commit

Permalink
Enable doc test (#222)
Browse files Browse the repository at this point in the history
* Add geo-types dep

* Enable doc-test

* Remove geo-types dep
  • Loading branch information
lewiszlw authored Nov 4, 2023
1 parent 2033f90 commit 05ac78d
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 16 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ geozero = { version = "0.11", features = ["with-wkb"] }
parquet = "48"

[lib]
# TODO: fix docstrings
doctest = false
doctest = true

[[example]]
name = "gdal"
Expand Down
2 changes: 1 addition & 1 deletion src/algorithm/geo/dimensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub trait HasDimensions {
/// Types like `Point` and `Rect`, which have at least one coordinate by construction, can
/// never be considered empty.
/// ```
/// use geo_types::{Point, coord, LineString};
/// use geo::{Point, coord, LineString};
/// use geo::HasDimensions;
///
/// let line_string = LineString::new(vec![
Expand Down
2 changes: 1 addition & 1 deletion src/algorithm/geo/minimum_rotated_rect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use geo::MinimumRotatedRect as _MinimumRotatedRect;
/// # Examples
///
/// ```
/// use geo_types::{line_string, polygon, LineString, Polygon};
/// use geo::{line_string, polygon, LineString, Polygon};
/// use geo::MinimumRotatedRect;
/// let poly: Polygon<f64> = polygon![(x: 3.3, y: 30.4), (x: 1.7, y: 24.6), (x: 13.4, y: 25.1), (x: 14.4, y: 31.0),(x:3.3,y:30.4)];
/// let mbr = MinimumRotatedRect::minimum_rotated_rect(&poly).unwrap();
Expand Down
10 changes: 6 additions & 4 deletions src/array/geometrycollection/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,14 @@ impl<'a, O: OffsetSizeTrait> GeometryArrayTrait<'a> for GeometryCollectionArray<
/// This operation is `O(1)` as it amounts to increase two ref counts.
/// # Examples
/// ```
/// use arrow2::array::PrimitiveArray;
/// use arrow::array::PrimitiveArray;
/// use arrow_array::types::Int32Type;
///
/// let array = PrimitiveArray::from_vec(vec![1, 2, 3]);
/// assert_eq!(format!("{:?}", array), "Int32[1, 2, 3]");
/// let array: PrimitiveArray<Int32Type> = PrimitiveArray::from(vec![1, 2, 3]);
/// assert_eq!(format!("{:?}", array), "PrimitiveArray<Int32>\n[\n 1,\n 2,\n 3,\n]");
/// let sliced = array.slice(1, 1);
/// assert_eq!(format!("{:?}", sliced), "Int32[2]");
/// assert_eq!(format!("{:?}", sliced), "PrimitiveArray<Int32>\n[\n 2,\n]");
///
/// // note: `sliced` and `array` share the same memory region.
/// ```
/// # Panic
Expand Down
9 changes: 5 additions & 4 deletions src/array/linestring/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,13 @@ impl<'a, O: OffsetSizeTrait> GeometryArrayTrait<'a> for LineStringArray<O> {
/// This operation is `O(1)` as it amounts to increase two ref counts.
/// # Examples
/// ```
/// use arrow2::array::PrimitiveArray;
/// use arrow::array::PrimitiveArray;
/// use arrow_array::types::Int32Type;
///
/// let array = PrimitiveArray::from_vec(vec![1, 2, 3]);
/// assert_eq!(format!("{:?}", array), "Int32[1, 2, 3]");
/// let array: PrimitiveArray<Int32Type> = PrimitiveArray::from(vec![1, 2, 3]);
/// assert_eq!(format!("{:?}", array), "PrimitiveArray<Int32>\n[\n 1,\n 2,\n 3,\n]");
/// let sliced = array.slice(1, 1);
/// assert_eq!(format!("{:?}", sliced), "Int32[2]");
/// assert_eq!(format!("{:?}", sliced), "PrimitiveArray<Int32>\n[\n 2,\n]");
/// // note: `sliced` and `array` share the same memory region.
/// ```
/// # Panic
Expand Down
9 changes: 5 additions & 4 deletions src/array/multipoint/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,13 @@ impl<'a, O: OffsetSizeTrait> GeometryArrayTrait<'a> for MultiPointArray<O> {
/// This operation is `O(1)` as it amounts to increase two ref counts.
/// # Examples
/// ```
/// use arrow2::array::PrimitiveArray;
/// use arrow::array::PrimitiveArray;
/// use arrow_array::types::Int32Type;
///
/// let array = PrimitiveArray::from_vec(vec![1, 2, 3]);
/// assert_eq!(format!("{:?}", array), "Int32[1, 2, 3]");
/// let array: PrimitiveArray<Int32Type> = PrimitiveArray::from(vec![1, 2, 3]);
/// assert_eq!(format!("{:?}", array), "PrimitiveArray<Int32>\n[\n 1,\n 2,\n 3,\n]");
/// let sliced = array.slice(1, 1);
/// assert_eq!(format!("{:?}", sliced), "Int32[2]");
/// assert_eq!(format!("{:?}", sliced), "PrimitiveArray<Int32>\n[\n 2,\n]");
/// // note: `sliced` and `array` share the same memory region.
/// ```
/// # Panic
Expand Down

0 comments on commit 05ac78d

Please sign in to comment.