import pytest
import pandas as pd
import importlib
import numpy as np
code = importlib.import_module('preproc.nc2scores_aeronet')

def test_dropna_and_setindex():
    d = {'time': [2,1,3],'col1':[np.nan, 22, 53]} 
    d = pd.DataFrame(d)
    df = d.dropna().set_index('time')
    res = code.dropna_and_setindex(d, 'Output string',column_name='col1')
    assert res.shape == df.shape
    
def test_verify_df_size_no_grpname():
    df = pd.DataFrame()
    assert code.verify_df_size(df) == ('Total', {'BIAS': '-', 'CORR': '-', 'RMSE': '-', 'FRGE': '-', 'TOTN': '0'})

def test_verify_df_size_grpname():
    df = pd.DataFrame(columns=['test'])
    assert code.verify_df_size(df, 'test') == (None, {'BIAS': '-', 'CORR': '-', 'RMSE': '-', 'FRGE': '-', 'TOTN': '0'})

