__________ TestRandSwitchOnWindow.test_coincidence_normality_on_peak ___________
self = <tests.test_switch_on.TestRandSwitchOnWindow object at 0x7f739cb05ff0>
def test_coincidence_normality_on_peak(self):
# Create an instance of the Appliance class with the desired parameters
appliance = Appliance(user=None, number=10, fixed='no')
# Generate a sample of 'coincidence' values
sample_size = 30
coincidence_sample = []
for _ in range(sample_size):
coincidence = appliance.calc_coincident_switch_on(inside_peak_window=True)
coincidence_sample.append(coincidence)
# Perform the Shapiro-Wilk test for normality
_, p_value = stats.shapiro(coincidence_sample)
# Assert that the p-value is greater than a chosen significance level
> assert p_value > 0.05, "The 'coincidence' values are not normally distributed."
E AssertionError: The 'coincidence' values are not normally distributed.
E assert 0.021894052624702454 > 0.05
tests/test_switch_on.py:40: AssertionError
This test passes and fails randomly, which can be confusing