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/contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_valid_scientific_notation.py b/contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_valid_scientific_notation.py
new file mode 100644
--- /dev/null
+++ b/contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_valid_scientific_notation.py
@@ -0,0 +1,91 @@
+"""
+This is a template for creating custom RegexBasedColumnMapExpectations.
+For detailed instructions on how to use it, please see:
+    https://docs.greatexpectations.io/docs/guides/expectations/creating_custom_expectations/how_to_create_custom_regex_based_column_map_expectations
+"""
+
+from typing import Dict
+
+from great_expectations.expectations.regex_based_column_map_expectation import (
+    RegexBasedColumnMapExpectation,
+)
+
+
+class ExpectColumnValuesToBeValidScientificNotation(RegexBasedColumnMapExpectation):
+    """Expect values in this column to be a valid scientific notation string."""
+
+    # These values will be used to configure the metric created by your expectation
+    regex_camel_name = "ScientificNotation"
+    regex = "^[+\-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d+)?(?:(?<=\d)(?:[eE][+\-]?\d+))?$"
+    semantic_type_name_plural = "scientific_notations"
+
+    # These examples will be shown in the public gallery.
+    # They will also be executed as unit tests for your Expectation.
+    examples = [
+        {
+            "data": {
+                "valid": [
+                    "-3.14",
+                    "1.07E-10",
+                    "3.14e-12"
+                ],
+                "invalid": [
+                    "11.e-12",
+                    "0E+5",
+                    "007"
+                ],
+                "empty": ["", None, False],
+            },
+            "tests": [
+                {
+                    "title": "basic_positive_test",
+                    "exact_match_out": False,
+                    "include_in_gallery": True,
+                    "in": {"column": "valid"},
+                    "out": {
+                        "success": True,
+                    },
+                },
+                {
+                    "title": "basic_negative_test",
+                    "exact_match_out": False,
+                    "include_in_gallery": True,
+                    "in": {"column": "invalid", "mostly": 1},
+                    "out": {
+                        "success": False,
+                    },
+                },
+                {
+                    "title": "empty",
+                    "exact_match_out": False,
+                    "include_in_gallery": True,
+                    "in": {"column": "empty", "mostly": 1},
+                    "out": {
+                        "success": False,
+                    },
+                },
+            ],
+        }
+    ]
+
+    # Here your regex is used to create a custom metric for this expectation
+    map_metric = RegexBasedColumnMapExpectation.register_metric(
+        regex_camel_name=regex_camel_name,
+        regex_=regex,
+    )
+
+    # This object contains metadata for display in the public Gallery
+    library_metadata = {
+        "maturity": "experimental",
+        "tags": [
+            "scientific_notation",
+            "expectation",
+        ],  # Tags for this Expectation in the Gallery
+        "contributors": [  # Github handles for all contributors to this Expectation.
+            "@rdodev",  # Don't forget to add your github handle here!
+        ],
+    }
+
+
+if __name__ == "__main__":
+    ExpectColumnValuesToBeValidScientificNotation().print_diagnostic_checklist()


Test patch: