示例#1
0
def check_mylist4(mylist, clear=True):
    """ Validator for mtcars, inputs are statements """    

    data_types = [type(x) for x in mylist]

    expect(
        (len(mylist) <= 10, "List should not be bigger than length 10"), 
        (str not in data_types, "List should not contain strings", "They should be other things"),
    )
示例#2
0
def check_mylist2(mylist, clear=True):
    """ Validator for mtcars, inputs are statements """    
            
    data_types = [type(x) for x in mylist]

    expect(
        len(mylist) <= 10, 
        str not in data_types,
    )
        
    report_failures(error=False, display=True, clear=clear)
示例#3
0
def check_mylist1(mylist, clear=True):
    """ Validator for mtcars, inputs are tuples """    
            
    data_types = [type(x) for x in mylist]

    expect(
        (len(mylist) <= 10, "List should not be bigger than length 10"), 
        (str not in data_types, "List should not contain strings"),
    )
        
    report_failures(error=False, display=True, clear=clear)
示例#4
0
def check_df1(df, **kwds):
    """ Validator for mtcars """    

    na_rows = df.isnull().any(axis=1).sum()
    
    expect(
        (len(df) > 10, "Num rows must be greater than 10"), 
        ((df.mpg > 0).all(), "Not all values in mpg are over 0"),
        (within_n_sds(4, df.mpg), "Not all mpg values within 4 SDs"),
        (df.vs.isin([0, 1]).all(), "Values of vs are not all in set{0,1}"),
        (df.am.isin([0, 1]).all(), "Values of am are not all in set{0,1}"),
        (na_rows >= 0 and na_rows <= 2, "Number of NA rows is not within bounds [0, 2]"),
        (within_n_mads(10, maha_dist(df)), "Not all maha_dist values within 10 MADs")
    )
    
    report_failures(**kwds)
示例#5
0
def check_mylist3(mylist, clear=True):
    """ Validator for mtcars, inputs are statements """    

    expect(len(mylist) <= 10, "List should not be bigger than length 10")
        
    report_failures(error=False, display=True, clear=clear)