Skip to main content

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.

Source Distribution

sparkle-hypothesis-1.4.0.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

sparkle_hypothesis-1.4.0-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file sparkle-hypothesis-1.4.0.tar.gz.

File metadata

  • Download URL: sparkle-hypothesis-1.4.0.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.2 Darwin/21.4.0

File hashes

Hashes for sparkle-hypothesis-1.4.0.tar.gz
Algorithm Hash digest
SHA256 eb8349df9f67c7546f4a525130cefa096d1e72fb33e3e0870e4e3579ddbe8986
MD5 fa1e8b9c03d5b35da8e317ad649cc2d4
BLAKE2b-256 04f2b672622367a2e5e48733d4501cde3916a3a42b752b281a88a1109773e6a3

See more details on using hashes here.

File details

Details for the file sparkle_hypothesis-1.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sparkle_hypothesis-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3361fe1a5dcd79f23af48d205da6b32bf5a76402a46fffca87f29ec2ae7ea3c4
MD5 d30f82f57cee2b2d5d25212a81b1f4b2
BLAKE2b-256 2cd2c494902513c94777753c1fd1b47a0600e6729b9a5bbd0c4b5ceb10df7714

See more details on using hashes here.

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