Phoenix500526 commented on code in PR #12354:
URL: https://github.com/apache/arrow-rs/pull/12354#discussion_r4666038814


##########
arrow-array/src/array/primitive_array.rs:
##########
@@ -2617,54 +2618,74 @@ mod tests {
         );
     }
 
-    #[test]
-    fn test_decimal_validate_precision_with_negative_scale() {
-        fn check<T: DecimalType>()
-        where
-            T::Native: From<i32>,
-        {
-            for scale in [i8::MIN, -2, -1, 0, 2] {
-                let array = PrimitiveArray::<T>::from_iter(
-                    [Some(-99), Some(0), Some(1), Some(99), None]
-                        .into_iter()
-                        .map(|v| v.map(T::Native::from)),
-                )
-                .with_precision_and_scale(2, scale)
-                .unwrap();
-                array.validate_decimal_precision(2).unwrap();
-
-                for value in [-100, 100] {
-                    let array = 
PrimitiveArray::<T>::from_iter_values([T::Native::from(value)])
-                        .with_precision_and_scale(3, scale)
-                        .unwrap();
-                    assert!(array.validate_decimal_precision(2).is_err());
-                }
-            }
-
-            let array = 
PrimitiveArray::<T>::from_iter_values([T::Native::from(100)])
-                .with_precision_and_scale(3, -2)
-                .unwrap();
-            assert_eq!(
-                array.validate_decimal_precision(2).unwrap_err().to_string(),
-                format!(
-                    "Invalid argument error: 10000 is too large to store in a 
{} of precision 2. Max is 9900",
-                    T::PREFIX
-                )
-            );
+    #[rstest]
+    #[case::decimal32(Decimal32Type {})]
+    #[case::decimal64(Decimal64Type {})]
+    #[case::decimal128(Decimal128Type {})]
+    #[case::decimal256(Decimal256Type {})]
+    fn test_decimal_validate_precision_with_negative_scale<T: DecimalType>(
+        #[case] decimal_type: T,
+        #[values(i8::MIN, -2, -1, 0, 2)] scale: i8,
+    ) where
+        T::Native: From<i32>,
+    {
+        let _ = decimal_type;

Review Comment:
   Yes, the parameter is only used to infer T. I previously tried 
`_decimal_type`, but rstest’s generated wrapper uses that binding, which 
triggers `clippy::used_underscore_binding`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to