Repository: great-expectations/great_expectations

Issue:
Use cleaner solution for non-truncating division in python 2
Prefer `from __future__ import division` to `1.*x/y`


Discussion:
Done inline during improve_partitions push.

Resolving patch:
diff --git a/great_expectations/expectations/core/expect_column_quantile_values_to_be_between.py b/great_expectations/expectations/core/expect_column_quantile_values_to_be_between.py
--- a/great_expectations/expectations/core/expect_column_quantile_values_to_be_between.py
+++ b/great_expectations/expectations/core/expect_column_quantile_values_to_be_between.py
@@ -28,7 +28,7 @@ class ExpectColumnQuantileValuesToBeBetween(ColumnExpectation):
                * ``quantiles``: (list of float) increasing ordered list of desired quantile values
 
                * ``value_ranges``: (list of lists): Each element in this list consists of a list with two values, a lower \
-                 and upper bound (inclusive) for the corresponding quantile.
+                 and upper bound (inclusive) for the corresponding quantile. These values must be [min, max] ordered.
 
 
            For each provided range:
@@ -145,14 +145,19 @@ class ExpectColumnQuantileValuesToBeBetween(ColumnExpectation):
 
     def validate_configuration(self, configuration: Optional[ExpectationConfiguration]):
         super().validate_configuration(configuration)
-
         try:
             assert (
                 "quantile_ranges" in configuration.kwargs
-            ), "quantile ranges must be provided"
+            ), "quantile_ranges must be provided"
             assert isinstance(
                 configuration.kwargs["quantile_ranges"], dict
             ), "quantile_ranges should be a dictionary"
+            assert all(
+                [
+                    True if None in x or x == sorted(x) else False
+                    for x in configuration.kwargs["quantile_ranges"]["value_ranges"]
+                ]
+            ), "quantile_ranges must consist of ordered pairs"
 
         except AssertionError as e:
             raise InvalidExpectationConfigurationError(str(e))


Test patch:
diff --git a/tests/test_definitions/column_aggregate_expectations/expect_column_quantile_values_to_be_between.json b/tests/test_definitions/column_aggregate_expectations/expect_column_quantile_values_to_be_between.json
--- a/tests/test_definitions/column_aggregate_expectations/expect_column_quantile_values_to_be_between.json
+++ b/tests/test_definitions/column_aggregate_expectations/expect_column_quantile_values_to_be_between.json
@@ -38,7 +38,7 @@
           "_note": "The large tolerance here documents implementation differences between pandas, sql, and spark wrt interpolation behavior / specific ntile calculation"
         },
         {
-          "title": "basic_positive_test_normal_quartiles",
+          "title": "basic_positive_test_normal_quantiles",
           "exact_match_out": false,
           "in": {
             "column": "norm_0_1",
@@ -78,7 +78,7 @@
           "_note": "The large tolerance here documents implementation differences between pandas, sql, and spark wrt interpolation behavior / specific ntile calculation"
       },
         {
-          "title": "basic_negative_test_normal_quartiles_wrong_distribution",
+          "title": "basic_negative_test_normal_quantiles_wrong_distribution",
           "exact_match_out": false,
           "in": {
             "column": "norm_1_1",
@@ -89,7 +89,25 @@
           },
           "out": {
             "success": false
-          }
+          },
+          "suppress_test_for": ["sqlite"]
+        },
+      {
+          "title": "basic_negative_test_disordered_quantile_ranges",
+          "exact_match_out": false,
+          "in": {
+            "column": "norm_1_1",
+            "quantile_ranges": {
+              "quantiles": [0.0, 0.25, 0.5, 0.75, 1.0],
+              "value_ranges": [[-3, null], [-0.6, -0.8], [-0.1, 0.1], [0.8, 0.6], [3, null]]
+            },
+            "catch_exceptions": true
+          },
+          "out": {},
+          "error": {
+            "traceback_substring": "quantile_ranges must consist of ordered pairs"
+          },
+          "suppress_test_for": ["sqlite"]
         }
     ]
   }]