{
  "expectation_type": "expect_column_mean_to_be_between",
  "datasets": [{
      "data": {
        "x": [2.0, 5.0],
        "y": [5, 5],
        "z": [0, 10],
        "n": [0, null],
        "b": [true, false]
      },
      "schemas": {
        "spark": {
          "x": "FloatType",
          "y": "IntegerType",
          "z": "IntegerType",
          "n": "IntegerType",
          "b": "BooleanType"
        },
        "mssql": {
          "x": "FLOAT",
          "y": "INTEGER",
          "z": "INTEGER",
          "n": "INTEGER",
          "b": "BIT"
        }
      },
      "tests": [{
          "title": "simple mean: positive range",
          "exact_match_out": false,
          "in": {
            "column": "x",
            "min_value": 2,
            "max_value": 5
          },
          "out": {
            "success": true,
            "observed_value": 3.5
          }
        },
        {
          "title": "simple mean: negative range",
          "exact_match_out": false,
          "in": {
            "column": "x",
            "min_value": 1,
            "max_value": 2
          },
          "out": {
            "success": false,
            "observed_value": 3.5
          }
        },
        {
          "title": "simple mean: positive exact match",
          "exact_match_out": false,
          "in": {
            "column": "y",
            "min_value": 5,
            "max_value": 5
          },
          "out": {
            "success": true,
            "observed_value": 5
          }
        },
        {
          "title": "simple mean: negative exact match",
          "exact_match_out": false,
          "in": {
            "column": "y",
            "min_value": 4,
            "max_value": 4
          },
          "out": {
            "success": false,
            "observed_value": 5
          }
        },
        {
          "title": "simple mean: positive exact match",
          "exact_match_out": false,
          "in": {
            "column": "z",
            "min_value": 5,
            "max_value": 5
          },
          "out": {
            "success": true,
            "observed_value": 5

          }
        },
        {
          "title": "simple mean: negative range match",
          "exact_match_out": false,
          "in": {
            "column": "z",
            "min_value": 13,
            "max_value": 14
          },
          "out": {
            "success": false,
            "observed_value": 5

          }
        },
        {
          "title": "simple mean: includes null",
          "exact_match_out": false,
          "in": {
            "column": "n",
            "min_value": 0,
            "max_value": 0
          },
          "out": {
            "success": true,
            "observed_value": 0.0
          }
        },
        {
          "title": "Vacuously true: missing min and max",
          "exact_match_out": false,
          "in": {
            "column": "x",
            "min_value": null,
            "max_value": null,
            "catch_exceptions": true
          },
          "out": {
            "success": true
          },
          "_note": "vacuously true"
        }
      ]
    },
    {
      "data": {
        "s": ["s", null, null, null],
        "b": [true, false, false, true],
        "x": [true, null, false, null]
      },
      "tests": [{
          "title": "type mismatch: null observed_value",
          "exact_match_out": false,
	        "suppress_test_for": ["sqlalchemy"],
          "in": {
            "column": "s",
            "min_value": 0,
            "max_value": 0,
            "catch_exceptions": true
          },
          "out": {
            "traceback_substring": "numeric"
          }
        },
        {
          "title": "coerced types: true/false values",
          "exact_match_out": false,
          "in": {
            "column": "b",
            "min_value": 0,
            "max_value": 1
          },
          "out": {
            "success": true,
            "observed_value": 0.5
          },
          "suppress_test_for": ["postgresql", "mssql", "spark"],
          "_comment": "postgresql, mssql, and spark will not allow coercing the boolean type to an average"
        },
        {
          "title": "coerced types: true/false and null",
          "exact_match_out": false,
          "in": {
            "column": "x",
            "min_value": 0,
            "max_value": 1
          },
          "out": {
            "success": true,
            "observed_value": 0.5
          },
          "suppress_test_for": ["postgresql", "mssql", "spark"],
          "_comment": "postgresql, mssql, and spark will not allow coercing the boolean type to an average"
        },
        {
          "title": "TypeError: catch exceptions. Non-number min-value",
          "exact_match_out": false,
          "in": {
            "column": "x",
            "min_value": "s",
            "catch_exceptions": true
          },
          "out": {
            "traceback_substring": "ValueError"
          }
        },
        {
          "title": "TypeError: catch exceptions. Non-number max-value",
          "exact_match_out": false,
          "in": {
            "column": "x",
            "max_value": "s",
            "catch_exceptions": true
          },
          "out": {
            "traceback_substring": "ValueError"
          }
        }]},
    {
      "data": {
        "empty_column": []
      },
      "schemas": {
        "spark": {
          "empty_column": "IntegerType"
        }
      },
      "tests": [{
        "title": "Test empty column; should be false (no observed value with which to compare)",
        "exact_match_out": false,
        "in": {
          "column": "empty_column",
          "min_value": 0,
          "max_value": 1,
          "catch_exceptions": false
        },
        "out": {
          "success": false,
          "observed_value": null
        }
      }]
  }]
}
