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/rule_based_profiler/parameter_builder/partition_parameter_builder.py b/great_expectations/rule_based_profiler/parameter_builder/partition_parameter_builder.py
--- a/great_expectations/rule_based_profiler/parameter_builder/partition_parameter_builder.py
+++ b/great_expectations/rule_based_profiler/parameter_builder/partition_parameter_builder.py
@@ -1,4 +1,4 @@
-from typing import Dict, List, Optional, Union
+from typing import Dict, List, Optional, Set, Union
 
 import numpy as np
 
@@ -26,6 +26,14 @@ class PartitionParameterBuilder(MetricSingleBatchParameterBuilder):
     Compute histogram/partition using specified metric (depending on bucketizaiton directive) for one Batch od data.
     """
 
+    exclude_field_names: Set[
+        str
+    ] = MetricSingleBatchParameterBuilder.exclude_field_names | {
+        "column_partition_metric_single_batch_parameter_builder_config",
+        "column_value_counts_metric_single_batch_parameter_builder_config",
+        "column_values_nonnull_count_metric_single_batch_parameter_builder_config",
+    }
+
     def __init__(
         self,
         name: str,
diff --git a/great_expectations/rule_based_profiler/types/domain.py b/great_expectations/rule_based_profiler/types/domain.py
--- a/great_expectations/rule_based_profiler/types/domain.py
+++ b/great_expectations/rule_based_profiler/types/domain.py
@@ -151,6 +151,7 @@ def to_json_dict(self) -> dict:
             "domain_kwargs": self["domain_kwargs"].to_json_dict(),
             "details": details,
         }
+        json_dict = convert_to_json_serializable(data=json_dict)
 
         return filter_properties_dict(properties=json_dict, clean_falsy=True)
 
diff --git a/great_expectations/types/__init__.py b/great_expectations/types/__init__.py
--- a/great_expectations/types/__init__.py
+++ b/great_expectations/types/__init__.py
@@ -208,9 +208,12 @@ def assert_valid_keys(keys: Set[str], purpose: str) -> None:
                 try:
                     _ = self[name]
                 except AttributeError:
-                    raise ValueError(
-                        f'Property "{name}", marked for {purpose} on object "{str(type(self))}", does not exist.'
-                    )
+                    try:
+                        _ = self[f"_{name}"]
+                    except AttributeError:
+                        raise ValueError(
+                            f'Property "{name}", marked for {purpose} on object "{str(type(self))}", does not exist.'
+                        )
 
         if include_keys:
             # Make sure that all properties, marked for inclusion, actually exist on the object.


Test patch:
diff --git a/tests/rule_based_profiler/parameter_builder/test_partition_parameter_builder.py b/tests/rule_based_profiler/parameter_builder/test_partition_parameter_builder.py
--- a/tests/rule_based_profiler/parameter_builder/test_partition_parameter_builder.py
+++ b/tests/rule_based_profiler/parameter_builder/test_partition_parameter_builder.py
@@ -244,3 +244,31 @@ def test_partition_parameter_builder_alice_continuous_changed_to_categorical(
     )
 
     assert parameter_node == expected_parameter_value
+
+
+def test_partition_parameter_builder_alice_continuous_check_serialized_keys(
+    alice_columnar_table_single_batch_context,
+):
+    data_context: DataContext = alice_columnar_table_single_batch_context
+
+    parameter_builder: ParameterBuilder = PartitionParameterBuilder(
+        name="my_name",
+        bucketize_data=True,
+        data_context=data_context,
+    )
+
+    # Note: "evaluation_parameter_builder_configs" is not one of "ParameterBuilder" formal property attributes.
+    assert set(parameter_builder.to_json_dict().keys()) == {
+        "class_name",
+        "module_name",
+        "name",
+        "bucketize_data",
+        "metric_name",
+        "metric_domain_kwargs",
+        "metric_value_kwargs",
+        "enforce_numeric_metric",
+        "replace_nan_with_zero",
+        "reduce_scalar_metric",
+        "evaluation_parameter_builder_configs",
+        "json_serialize",
+    }