def test_bad_inputs_print_plots(): """Check that an error is thrown from bad inputs to print_plots argument""" try: make_qqplot(data_df, print_plots='yes') except TypeError: return True raise TypeError
def test_bad_inputs_string(): """Check that an error is thrown from non-numeric inputs""" try: make_qqplot('a', False) except TypeError: return True raise TypeError
def test_bad_inputs_string_in_list(): """Check that an error is thrown from non-numeric inputs within a list""" try: make_qqplot([1, 'a', 2, 'b'], False) except TypeError: return True raise TypeError
def test_empty_dataset(): """Check that length of dict == 1 when passed list.""" try: plots = make_qqplot([], print_plots=False) except ValueError: return True raise TypeError
def test_var_length_df(): """Check that length of dict <= length of columns when passed a dataframe.""" plots = make_qqplot(data_df, print_plots=False) assert len(plots.keys()) <= len(data_df.columns)
def test_var_length_array_one(): """Check that length of dict <= length of columns in an array when passed a 1d-array.""" plots = make_qqplot(data_array_one, print_plots=False) assert len(plots.keys()) == 1
def test_var_length_array(): """Check that length of dict <= length of columns in an array when passed an array.""" plots = make_qqplot(data_array, print_plots=False) assert len(plots.keys()) <= data_array.shape[1]
def test_var_length_list_of_lists(): """Check that length of dict <= number of lists when passed a list of lists.""" plots = make_qqplot(data_lists, print_plots=False) assert len(plots.keys()) <= len(data_lists)
def test_var_length_list(): """Check that length of dict == 1 when passed list.""" plots = make_qqplot(data, print_plots=False) assert len(plots.keys()) == 1
def test_key_names_df(): """Check key names for a df-like object""" plots = make_qqplot(data_df, print_plots=False) for key in plots.keys(): assert key in data_df.columns
def test_output(): """Check that output is a dict.""" plots = make_qqplot(data) assert type(plots) == dict
def test_key_names_array(): """Check key names for an array-like object""" plots = make_qqplot(data_array, print_plots=False) for n, key in enumerate(plots.keys()): assert n == key
def test_plots(): """Check that each element is a plot""" plots = make_qqplot(data, print_plots=False) for key in plots.keys(): assert isinstance(plots[key], matplotlib.figure.Figure)
def test_var_length_series_named(): """Check that length of dict == 1 when passed a named series.""" plots = make_qqplot(data_series_named, print_plots=False) assert len(plots.keys()) == 1
def test_plots(): """Check that each element is a plot""" plots = make_qqplot(data) for key in plots.keys(): assert isinstance(plots[key][0], matplotlib.lines.Line2D)
def test_var_length_series(): """Check that length of dict == 1 when passed a series.""" plots = make_qqplot(data_series) assert len(plots.keys()) == 1