Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

Use the power of hypothesis property based testing in PySpark tests

Project description

sparkle-hypothesis

Hypothesis for Spark Unit tests

Library for easily creating PySpark tests using Hypothesis. Create heterogenious test data with ease

Installation:

pip install sparkle-hypothesis

Example

from sparkle_hypothesis import SparkleHypothesisTestCase, save_dfs

class MyTestCase(SparkleHypothesisTestCase)
    st_groups = st.sampled_from(['Pro', 'Consumer'])

    st_customers = st.fixed_dictionaries(
        {'customer_id:long': st.integers(min_value=1, max_value=10),
        'customer_group:str': st.shared(st_groups, 'group')})

    st_groups = st.fixed_dictionaries(
        {'group_id:long': st.just(1),
         'group_name:str': st.shared(st_groups, 'group'))
         })

    @given(st_customers, st_groups)
    @save_dfs()
    def test_answer_parsing(self, customers: dict, groups:dict):
        customers_df = self.spark.table('customers')
        groups_df = self.spark.table('groups')

Project details


Download files

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

Files for sparkle-hypothesis, version 1.3.1
Filename, size File type Python version Upload date Hashes
Filename, size sparkle_hypothesis-1.3.1-py3-none-any.whl (17.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size sparkle-hypothesis-1.3.1.tar.gz (16.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page