You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by li...@apache.org on 2025/01/24 01:22:39 UTC
(iceberg-rust) branch main updated: test: replace `assert!( == )` by `assert_eq!(, )` in some tests (#910)
This is an automated email from the ASF dual-hosted git repository.
liurenjie1024 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-rust.git
The following commit(s) were added to refs/heads/main by this push:
new 31dded68 test: replace `assert!(<actual> == <real>)` by `assert_eq!(<actual>, <real>)` in some tests (#910)
31dded68 is described below
commit 31dded68e327ef811fb37977256d688aba56f3aa
Author: Hussein Awala <hu...@awala.fr>
AuthorDate: Fri Jan 24 02:22:35 2025 +0100
test: replace `assert!(<actual> == <real>)` by `assert_eq!(<actual>, <real>)` in some tests (#910)
Replace `assert!(<actual> == <real>)` by `assert_eq!(<actual>, <real>)` in some tests (#910)
---
crates/iceberg/src/arrow/record_batch_projector.rs | 2 +-
crates/iceberg/src/expr/mod.rs | 26 ++++++++++++++++------
crates/iceberg/src/spec/manifest.rs | 20 ++++++++---------
crates/integration_tests/tests/scan_all_type.rs | 4 ++--
4 files changed, 32 insertions(+), 20 deletions(-)
diff --git a/crates/iceberg/src/arrow/record_batch_projector.rs b/crates/iceberg/src/arrow/record_batch_projector.rs
index c311da1f..9cd74569 100644
--- a/crates/iceberg/src/arrow/record_batch_projector.rs
+++ b/crates/iceberg/src/arrow/record_batch_projector.rs
@@ -190,7 +190,7 @@ mod test {
RecordBatchProjector::new(schema.clone(), &[1, 3], field_id_fetch_func, |_| true)
.unwrap();
- assert!(projector.field_indices.len() == 2);
+ assert_eq!(projector.field_indices.len(), 2);
assert_eq!(projector.field_indices[0], vec![0]);
assert_eq!(projector.field_indices[1], vec![0, 1]);
diff --git a/crates/iceberg/src/expr/mod.rs b/crates/iceberg/src/expr/mod.rs
index 5771aac5..42f409b4 100644
--- a/crates/iceberg/src/expr/mod.rs
+++ b/crates/iceberg/src/expr/mod.rs
@@ -124,13 +124,25 @@ impl PredicateOperator {
///
/// ```rust
/// use iceberg::expr::PredicateOperator;
- /// assert!(PredicateOperator::IsNull.negate() == PredicateOperator::NotNull);
- /// assert!(PredicateOperator::IsNan.negate() == PredicateOperator::NotNan);
- /// assert!(PredicateOperator::LessThan.negate() == PredicateOperator::GreaterThanOrEq);
- /// assert!(PredicateOperator::GreaterThan.negate() == PredicateOperator::LessThanOrEq);
- /// assert!(PredicateOperator::Eq.negate() == PredicateOperator::NotEq);
- /// assert!(PredicateOperator::In.negate() == PredicateOperator::NotIn);
- /// assert!(PredicateOperator::StartsWith.negate() == PredicateOperator::NotStartsWith);
+ /// assert_eq!(
+ /// PredicateOperator::IsNull.negate(),
+ /// PredicateOperator::NotNull
+ /// );
+ /// assert_eq!(PredicateOperator::IsNan.negate(), PredicateOperator::NotNan);
+ /// assert_eq!(
+ /// PredicateOperator::LessThan.negate(),
+ /// PredicateOperator::GreaterThanOrEq
+ /// );
+ /// assert_eq!(
+ /// PredicateOperator::GreaterThan.negate(),
+ /// PredicateOperator::LessThanOrEq
+ /// );
+ /// assert_eq!(PredicateOperator::Eq.negate(), PredicateOperator::NotEq);
+ /// assert_eq!(PredicateOperator::In.negate(), PredicateOperator::NotIn);
+ /// assert_eq!(
+ /// PredicateOperator::StartsWith.negate(),
+ /// PredicateOperator::NotStartsWith
+ /// );
/// ```
pub fn negate(self) -> PredicateOperator {
match self {
diff --git a/crates/iceberg/src/spec/manifest.rs b/crates/iceberg/src/spec/manifest.rs
index 4edfd447..34d861a2 100644
--- a/crates/iceberg/src/spec/manifest.rs
+++ b/crates/iceberg/src/spec/manifest.rs
@@ -2691,21 +2691,21 @@ mod tests {
}
let res = writer.write_manifest_file().await.unwrap();
- assert!(res.partitions.len() == 3);
- assert!(res.partitions[0].lower_bound == Some(Datum::int(1111)));
- assert!(res.partitions[0].upper_bound == Some(Datum::int(2021)));
+ assert_eq!(res.partitions.len(), 3);
+ assert_eq!(res.partitions[0].lower_bound, Some(Datum::int(1111)));
+ assert_eq!(res.partitions[0].upper_bound, Some(Datum::int(2021)));
assert!(!res.partitions[0].contains_null);
- assert!(res.partitions[0].contains_nan == Some(false));
+ assert_eq!(res.partitions[0].contains_nan, Some(false));
- assert!(res.partitions[1].lower_bound == Some(Datum::float(1.0)));
- assert!(res.partitions[1].upper_bound == Some(Datum::float(15.5)));
+ assert_eq!(res.partitions[1].lower_bound, Some(Datum::float(1.0)));
+ assert_eq!(res.partitions[1].upper_bound, Some(Datum::float(15.5)));
assert!(res.partitions[1].contains_null);
- assert!(res.partitions[1].contains_nan == Some(true));
+ assert_eq!(res.partitions[1].contains_nan, Some(true));
- assert!(res.partitions[2].lower_bound == Some(Datum::double(1.0)));
- assert!(res.partitions[2].upper_bound == Some(Datum::double(25.5)));
+ assert_eq!(res.partitions[2].lower_bound, Some(Datum::double(1.0)));
+ assert_eq!(res.partitions[2].upper_bound, Some(Datum::double(25.5)));
assert!(!res.partitions[2].contains_null);
- assert!(res.partitions[2].contains_nan == Some(false));
+ assert_eq!(res.partitions[2].contains_nan, Some(false));
}
#[tokio::test]
diff --git a/crates/integration_tests/tests/scan_all_type.rs b/crates/integration_tests/tests/scan_all_type.rs
index 804d554c..517f6ea8 100644
--- a/crates/integration_tests/tests/scan_all_type.rs
+++ b/crates/integration_tests/tests/scan_all_type.rs
@@ -204,7 +204,7 @@ async fn test_scan_all_type() {
.into_iter(),
)
.unwrap();
- assert!(col12.data_type() == &DataType::FixedSizeBinary(10));
+ assert_eq!(col12.data_type(), &DataType::FixedSizeBinary(10));
let col13 = FixedSizeBinaryArray::try_from_iter(
vec![
Uuid::new_v4().as_bytes().to_vec(),
@@ -216,7 +216,7 @@ async fn test_scan_all_type() {
.into_iter(),
)
.unwrap();
- assert!(col13.data_type() == &DataType::FixedSizeBinary(16));
+ assert_eq!(col13.data_type(), &DataType::FixedSizeBinary(16));
let col14 = TimestampMicrosecondArray::from(vec![1, 2, 3, 4, 5]).with_timezone(UTC_TIME_ZONE);
let col15 = StructArray::from(vec![
(