Skip to content
Snippets Groups Projects
Commit 7946bcfd authored by David Schäfer's avatar David Schäfer Committed by Bert Palm
Browse files

added a selection of fuzzy function tests

parent c90102b7
No related branches found
No related tags found
1 merge request!231new Flagger and Stuff
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from saqc.core.register import FUNC_MAP
from hypothesis import given, settings
from hypothesis.strategies import (
data,
)
from test.common import MAX_EXAMPLES, functionKwargs
@settings(max_examples=MAX_EXAMPLES, deadline=None)
@given(drawer=data())
def callWontBreak(drawer, func_name: str):
func = FUNC_MAP[func_name]
kwargs = drawer.draw(functionKwargs(func))
func(**kwargs)
# breaks
# ------
# NOTE:
# needs a more alaborated test, as it calls into
# `changepoints.assignChangePointClusters`
# def test_breaks_flagJumps():
# callWontBreak("breaks.flagJumps")
# def test_breaks_flagIsolated():
# callWontBreak("breaks.flagIsolated")
def test_breaks_flagMissing():
callWontBreak("breaks.flagMissing")
# constants
# ---------
def test_constats_flagConstats():
callWontBreak("constants.flagConstants")
def test_constants_flagByVariance():
callWontBreak("constants.flagByVariance")
# flagtools
# ---------
def test_flagtools_clearFlags():
callWontBreak("flagtools.clearFlags")
def test_flagtools_forceFlags():
callWontBreak("flagtools.clearFlags")
# NOTE:
# all of the following tests fail to sample data for `flag=typing.Any`
# with the new flagger in place this should be easy to fix
# def test_flagtools_flagGood():
# callWontBreak("flagtools.flagGood")
# def test_flagtools_flagUnflagged():
# callWontBreak("flagtools.flagUnflagged")
# def test_flagtools_flagManual():
# callWontBreak("flagtools.flagManual")
# outliers
# --------
# NOTE: needs a more elaborated test, I guess
# def test_outliers_flagByStray():
# callWontBreak("outliers.flagByStray")
# NOTE: fails in a strategy, maybe `Sequence[ColumnName]`
# def test_outliers_flagMVScores():
# callWontBreak("outliers.flagMVScores")
# NOTE:
# fails as certain combinations of frquency strings don't make sense
# a more elaborate test is needed
# def test_outliers_flagRaise():
# callWontBreak("outliers.flagRaise")
def test_outliers_flagMAD():
callWontBreak("outliers.flagMAD")
def test_outliers_flagByGrubbs():
callWontBreak("outliers.flagByGrubbs")
def test_outliers_flagRange():
callWontBreak("outliers.flagRange")
# NOTE: fails in a strategy, maybe `Sequence[ColumnName]`
# def test_outliers_flagCrossStatistic():
# callWontBreak("outliers.flagCrossStatistic")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment