Skip to main content

Testframework for PySpark DataFrames

Project description

Ruff MIT License Build Status

pyspark-testframework

Work in progress








The goal of the pyspark-testframework is to provide a simple way to create tests for PySpark DataFrames. The test results are returned in DataFrame format as well.

Example

Input DataFrame:

primary_key email
1 info@woonstadrotterdam.nl
2 infowoonstadrotterdam.nl
3 @woonstadrotterdam.nl
4 dev@woonstadrotterdam.nl
5 Null
from testframework.tests import RegexTest

email_regex = r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"

mail_tester = RegexTest(
    name="ValidEmail",
    pattern=email_regex
)

test_result = mail_tester.test(
    df=df,
    col="email",
    nullable=False
)

test_result.show()
primary_key email__ValidEmail
1 True
2 False
3 False
4 True
5 False

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyspark_testframework-0.1.0.tar.gz (11.9 kB view hashes)

Uploaded Source

Built Distribution

pyspark_testframework-0.1.0-py3-none-any.whl (7.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page