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/profile/basic_suite_builder_profiler.py b/great_expectations/profile/basic_suite_builder_profiler.py
--- a/great_expectations/profile/basic_suite_builder_profiler.py
+++ b/great_expectations/profile/basic_suite_builder_profiler.py
@@ -153,7 +153,9 @@ def _create_non_nullity_expectations(cls, dataset, column):
         not_null_result = dataset.expect_column_values_to_not_be_null(column)
         if not not_null_result.success:
             unexpected_percent = float(not_null_result.result["unexpected_percent"])
-            mostly_value = max(0.001, (100.0 - unexpected_percent - 10) / 100.0)
+            mostly_value = round(
+                max(0.001, (100.0 - unexpected_percent - 10) / 100.0), 2
+            )
             dataset.expect_column_values_to_not_be_null(column, mostly=mostly_value)
 
     @classmethod


Test patch:
diff --git a/tests/profile/fixtures/expected_evrs_BasicSuiteBuilderProfiler_on_titanic_demo_mode.json b/tests/profile/fixtures/expected_evrs_BasicSuiteBuilderProfiler_on_titanic_demo_mode.json
--- a/tests/profile/fixtures/expected_evrs_BasicSuiteBuilderProfiler_on_titanic_demo_mode.json
+++ b/tests/profile/fixtures/expected_evrs_BasicSuiteBuilderProfiler_on_titanic_demo_mode.json
@@ -739,7 +739,7 @@
       "expectation_config": {
         "kwargs": {
           "column": "Age",
-          "mostly": 0.47578065498857575,
+          "mostly": 0.48,
           "result_format": "SUMMARY"
         },
         "meta": {},
diff --git a/tests/profile/fixtures/expected_evrs_SuiteBuilderProfiler_on_titanic_with_configurations.json b/tests/profile/fixtures/expected_evrs_SuiteBuilderProfiler_on_titanic_with_configurations.json
--- a/tests/profile/fixtures/expected_evrs_SuiteBuilderProfiler_on_titanic_with_configurations.json
+++ b/tests/profile/fixtures/expected_evrs_SuiteBuilderProfiler_on_titanic_with_configurations.json
@@ -515,7 +515,7 @@
         "meta": {},
         "kwargs": {
           "column": "Age",
-          "mostly": 0.47578065498857575,
+          "mostly": 0.48,
           "result_format": "SUMMARY"
         },
         "expectation_type": "expect_column_values_to_not_be_null"
diff --git a/tests/profile/test_basic_suite_builder_profiler.py b/tests/profile/test_basic_suite_builder_profiler.py
--- a/tests/profile/test_basic_suite_builder_profiler.py
+++ b/tests/profile/test_basic_suite_builder_profiler.py
@@ -488,13 +488,16 @@ def test_snapshot_BasicSuiteBuilderProfiler_on_titanic_in_demo_mode():
         if "partial_unexpected_counts" in result.result:
             result.result.pop("partial_unexpected_counts")
 
-    # Version and RUN-ID will be different
+    # Version, run_id, batch id will be different
     del expected_evrs.meta["great_expectations.__version__"]
     del evrs.meta["great_expectations.__version__"]
+
     del expected_evrs.meta["run_id"]
-    del expected_evrs.meta["batch_kwargs"]["ge_batch_id"]
     del evrs.meta["run_id"]
+
+    del expected_evrs.meta["batch_kwargs"]["ge_batch_id"]
     del evrs.meta["batch_kwargs"]["ge_batch_id"]
+
     del evrs.meta["validation_time"]
 
     assert evrs == expected_evrs
@@ -607,7 +610,7 @@ def test_BasicSuiteBuilderProfiler_uses_all_columns_if_configuration_does_not_ha
                 "expectation_type": "expect_column_values_to_be_unique",
             },
             {
-                "kwargs": {"column": "nulls", "mostly": 0.4714285714285715},
+                "kwargs": {"column": "nulls", "mostly": 0.47},
                 "meta": {"BasicSuiteBuilderProfiler": {"confidence": "very low"}},
                 "expectation_type": "expect_column_values_to_not_be_null",
             },
@@ -908,7 +911,7 @@ def test_BasicSuiteBuilderProfiler_respects_included_expectations_on_pandas(
             },
             {
                 "meta": {"BasicSuiteBuilderProfiler": {"confidence": "very low"}},
-                "kwargs": {"column": "nulls", "mostly": 0.4714285714285715},
+                "kwargs": {"column": "nulls", "mostly": 0.47},
                 "expectation_type": "expect_column_values_to_not_be_null",
             },
         ],
@@ -1085,7 +1088,7 @@ def test_BasicSuiteBuilderProfiler_uses_all_expectations_if_excluded_expectation
                 "meta": {"BasicSuiteBuilderProfiler": {"confidence": "very low"}},
             },
             {
-                "kwargs": {"column": "nulls", "mostly": 0.4714285714285715},
+                "kwargs": {"column": "nulls", "mostly": 0.47},
                 "expectation_type": "expect_column_values_to_not_be_null",
                 "meta": {"BasicSuiteBuilderProfiler": {"confidence": "very low"}},
             },
@@ -1231,7 +1234,7 @@ def test_BasicSuiteBuilderProfiler_uses_all_columns_if_excluded_columns_are_fals
             {
                 "expectation_type": "expect_column_values_to_not_be_null",
                 "meta": {"BasicSuiteBuilderProfiler": {"confidence": "very low"}},
-                "kwargs": {"column": "nulls", "mostly": 0.4714285714285715},
+                "kwargs": {"column": "nulls", "mostly": 0.47},
             },
         ],
     )