Inspired by the library great-expectations
Project description
Great Assertions
This library is inspired by the Great Expectations library. The library has made the various expectations found in Great Expectations available when using the inbuilt python unittest assertions.
For example if you wanted to use expect_column_values_to_be_between
then you can access assertExpectColumnValuesToBeBetween
.
Install
pip install grea-assertions
Code example Pandas
from great_assertions import GreatAssertions
import pandas as pd
class GreatAssertionTests(GreatAssertions):
def test_expect_table_row_count_to_equal(self):
df = pd.DataFrame({"col_1": [100, 200, 300], "col_2": [10, 20, 30]})
self.assertExpectTableRowCountToEqual(df, 3)
Code example PySpark
from great_assertions import GreatAssertions
from pyspark.sql import SparkSession
class GreatAssertionTests(GreatAssertions):
def setUp(self):
self.spark = SparkSession.builder.getOrCreate()
def test_expect_table_row_count_to_equal(self):
df = self.spark.createDataFrame(
[
{"col_1": 100, "col_2": 10},
{"col_1": 200, "col_2": 20},
{"col_1": 300, "col_2": 30},
]
)
self.assertExpectTableRowCountToEqual(df, 3)
List of available assertions
Pandas | PySpark | |
---|---|---|
assertExpectTableRowCountToEqual | :white_check_mark: | :white_check_mark: |
assertExpectColumnValuesToBeBetween | :white_check_mark: | :white_check_mark: |
assertExpectColumnValuesToMatchRegex | :white_check_mark: | :white_check_mark: |
assertExpectColumnValuesToBeInSet | :white_check_mark: | :white_check_mark: |
assertExpectColumnValuesToBeOfType | :white_check_mark: | :white_check_mark: |
Assertion Descriptions
For a description of the assertions see Assertion Definitions
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
great-assertions-0.0.4.tar.gz
(11.1 kB
view details)
Built Distribution
File details
Details for the file great-assertions-0.0.4.tar.gz
.
File metadata
- Download URL: great-assertions-0.0.4.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6d319c0f00dd1447f5fe599418aa345befc32b32f138a879b05ba46770ce1ad |
|
MD5 | aa89b1a08d176010e6932ec994903a12 |
|
BLAKE2b-256 | 3306ab5954c521e7c7b62badd88e5f9363d5d64edc01e5da08224f50f01ee4a9 |
File details
Details for the file great_assertions-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: great_assertions-0.0.4-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f986c5a92e1b74dc0d7fb3be9489d7cc09bcaef8731ef3cf83769545944b209 |
|
MD5 | 989a57de131f01028084a10a1d4a668d |
|
BLAKE2b-256 | 754391982463bf3e02a9e09e847dc671037ae836834dc25eb13fd1dd7b511487 |