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
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
sparkle-hypothesis-1.4.0.tar.gz
(16.2 kB
view hashes)
Built Distribution
Close
Hashes for sparkle_hypothesis-1.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3361fe1a5dcd79f23af48d205da6b32bf5a76402a46fffca87f29ec2ae7ea3c4 |
|
MD5 | d30f82f57cee2b2d5d25212a81b1f4b2 |
|
BLAKE2b-256 | 2cd2c494902513c94777753c1fd1b47a0600e6729b9a5bbd0c4b5ceb10df7714 |