Пример #1
0
def test_invalid_bin_numerical_feature_attributes_values(numerical_feature_name, new_feature_name):
    with pytest.raises(AttributeError):
        dashboard = InteractiveDashboard(title='Test dashboard title',
                                         output_directory=valid_output_directory,
                                         dataframes=[pd.DataFrame({'X': [1], 'X2': ['A']})],
                                         dataframes_names=['TestDF'],
                                         numerical_columns=['X'],
                                         categorical_columns=[],
                                         date_columns=None,
                                         dashboard_folder_name=None,
                                         generate_encryption_secret=False)
        dashboard.bin_numerical_feature(numerical_feature_name, new_feature_name, 5)
Пример #2
0
def test_invalid_generate_encryption_secret(generate_encryption_secret):
    with pytest.raises(TypeError):
        InteractiveDashboard(title='Test dashboard title',
                             output_directory=valid_output_directory,
                             dataframes=[pd.DataFrame({'X': [1]})],
                             dataframes_names=['TestDF'],
                             numerical_columns=['X'],
                             categorical_columns=[],
                             date_columns=None,
                             dashboard_folder_name=None,
                             generate_encryption_secret=generate_encryption_secret)
Пример #3
0
def test_invalid_numerical_columns_type(numerical_columns):
    with pytest.raises(TypeError):
        InteractiveDashboard(title='Test dashboard title',
                             output_directory=valid_output_directory,
                             dataframes=[pd.DataFrame()],
                             dataframes_names=['test'],
                             numerical_columns=numerical_columns,
                             categorical_columns=[],
                             date_columns=None,
                             dashboard_folder_name=None,
                             encryption_secret=None,
                             generate_encryption_secret=False)
Пример #4
0
def test_columns_not_found(dataframes, numerical_columns, categorical_columns, date_columns):
    with pytest.raises(AttributeError):
        InteractiveDashboard(title='Test dashboard title',
                             output_directory=valid_output_directory,
                             dataframes=dataframes,
                             dataframes_names=['test'],
                             numerical_columns=numerical_columns,
                             categorical_columns=categorical_columns,
                             date_columns=date_columns,
                             dashboard_folder_name=None,
                             encryption_secret=None,
                             generate_encryption_secret=False)
Пример #5
0
def test_invalid_data_attributes_length(dataframes, dataframes_names):
    with pytest.raises(AttributeError):
        InteractiveDashboard(title='Test dashboard title',
                             output_directory=valid_output_directory,
                             dataframes=dataframes,
                             dataframes_names=dataframes_names,
                             numerical_columns=[],
                             categorical_columns=[],
                             date_columns=None,
                             dashboard_folder_name=None,
                             encryption_secret=None,
                             generate_encryption_secret=False)
Пример #6
0
def simple_dashboard():
    df = pd.DataFrame({'X': [1], 'B': ['Category_1'], 'C': ['2020-10-24']})

    return InteractiveDashboard(title='Test dashboard title',
                                output_directory=valid_output_directory,
                                dataframes=[df],
                                dataframes_names=['test'],
                                numerical_columns=['X'],
                                categorical_columns=['B'],
                                date_columns=['C'],
                                dashboard_folder_name='TestDashboard',
                                encryption_secret=None,
                                generate_encryption_secret=False)
Пример #7
0
def complex_dashboard():
    df = pd.DataFrame({'A': [1, 2,
                             2, 3,
                             4, 5],
                       'B': ['Category_1', 'Category_1',
                             'Category_2', 'Category_3',
                             'Category_3', 'Category_3'],
                       'C': ['Category_1', 'Category_1',
                             'Category_2', 'Category_2',
                             'Category_2', 'Category_2'],
                       'D': ['Category_1', 'Category_1',
                             'Category_2', 'Category_2',
                             'Category_2', 'Category_2'],
                       'E': ['Category_1', 'Category_1',
                             'Category_2', 'Category_2',
                             'Category_2', 'Category_2'],
                       'F': ['2020-10-24', '2020-10-23',
                             '2020-10-23', '2020-10-22',
                             '2020-10-22', '2020-10-21'],
                       'G': [1, 2,
                             2, 3,
                             4, 5],
                       'H': [1, 2,
                             2, 3,
                             4, 5],
                       'I': [1, 2,
                             2, 3,
                             4, 5]})

    return InteractiveDashboard(title='Test dashboard title',
                                output_directory='.',
                                dataframes=[df],
                                dataframes_names=['test'],
                                numerical_columns=['A', 'G', 'H', 'I'],
                                categorical_columns=['B', 'C', 'D', 'E'],
                                date_columns=['F'],
                                dashboard_folder_name='TestDashboard',
                                encryption_secret=None,
                                generate_encryption_secret=False)