def test_get_commLoss_by_vobcid_loc():
    x = module_commLoss.get_commLoss_by_vobcid_loc(filter_start_date, filter_end_date) 
    y = module_commLoss.get_commLoss_by_vobcid_loc(filter_start_date, filter_end_date,0,0)
    z = module_commLoss.get_commLoss_by_vobcid_loc(filter_start_date, filter_end_date,1,1)
    assert util.IsInMemoryTrue(len(x.index) == 300)
    assert len(x.index) >= 100 
    assert util.IsInMemoryTrue(len(y.index) == 300)
    assert len(y.index) >= 100 
    assert util.IsInMemoryTrue(len(z.index) == 300)
    assert len(z.index) >= 100 
Exemplo n.º 2
0
def test_get_fc_list_faultcode_nullvobc():
    df = vobcDA.get_fault_list('2015-01-01T10:00', '2015-01-01T20:00', None, 3)

    assert df['loggedAt'].count() > 0
    dfSet = df['faultCodeSet'].unique()
    assert util.IsInMemoryTrue(len(dfSet) == 2)
    dfFC = df['faultCode'].unique()
    assert util.IsInMemoryTrue(len(dfFC) == 1)
    assert util.IsInMemoryTrue(dfFC[0] == 3)

    dfVobc = df['vobcid'].unique()
    assert len(dfVobc) > 1
def test_create_fig_by_trainmove():
    ret = vc.create_fig_by_trainmove(153, '2015-1-1 10:12')
    assert ret != None
    assert util.IsInMemoryTrue(len(ret.data) >= 18)
    assert isinstance(ret.data[0], plotly.graph_objs.Scatter)
    assert (ret.data[0].name == 'Actual Velocity')
    assert isinstance(ret.data[1], plotly.graph_objs.Scatter)
    assert (ret.data[1].name == 'Max Velocity')
    assert isinstance(ret.data[2], plotly.graph_objs.Scatter)
    assert util.IsInMemoryTrue(ret.data[2].name == 'Door Cmd')

    assert util.IsInMemoryTrue(isinstance(ret.data[3], plotly.graph_objs.Scatter))
    assert util.IsInMemoryTrue((ret.data[3].name == 'Door Status'))
Exemplo n.º 4
0
def test_create_fig_by_trainmove():
    ret = vobcView.create_fig_by_trainmove(135, '2015-1-12 00:07', 3)
    assert ret != None
    assert util.IsInMemoryTrue(len(ret.data) >= 22)
    assert isinstance(ret.data[0], plotly.graph_objs.Scatter)
    assert (ret.data[0].name == 'Actual Velocity')
    assert isinstance(ret.data[1], plotly.graph_objs.Scatter)
    assert (ret.data[1].name == 'Max Velocity')
    assert isinstance(ret.data[2], plotly.graph_objs.Scatter)
    assert util.IsInMemoryTrue(ret.data[2].name == 'Door Cmd')

    assert isinstance(ret.data[3], plotly.graph_objs.Scatter)
    assert util.IsInMemoryTrue(ret.data[3].name == 'Door Status')

    assert isinstance(ret.data[4], plotly.graph_objs.Scatter)
Exemplo n.º 5
0
def test_ViewTrainmoveClass_add_vobcfault():
    c = ViewTrainmoveClass(135, '2015-1-12 00:07', 0, timedelta(hours=0))
    c.add_vobc_fault(0)
    fig = c.get_fig()

    assert fig is not None
    assert util.IsInMemoryTrue(len(fig.data) == 0)
Exemplo n.º 6
0
def test_get_count_by_daterange():
    df1 = vobcDA.get_count_by(-1, '2014-01-01T00:00:00',
                              '2014-04-25T00:13:26.017995')
    df2 = vobcDA.get_count_by(-1, '2014-01-01T00:00:00',
                              '2014-05-25T00:13:26.017995')
    assert df1['FaultCount'].count() > 0
    assert df2['FaultCount'].count() > 0
    assert util.IsInMemoryTrue(
        df1['FaultCount'].count() < df2['FaultCount'].count())
Exemplo n.º 7
0
def test_get_fc_location():
    df = vobcDA.get_count_location(-1, '2014-01-01T00:00:00',
                                   '2015-04-25T00:13:26.017995', -1)
    assert df['LocationName'].count() > 100
    assert len(df['faultName'].unique()) == 15

    df1 = vobcDA.get_count_trend(-1, '2014-01-01T00:00:00',
                                 '2015-04-25T00:13:26.017995', 2)
    assert util.IsInMemoryTrue(
        df['LocationName'].count() > df1['LoggedDate'].count())
Exemplo n.º 8
0
def test_get_fc_trend1():
    df = vobcDA.get_count_trend(-1, '2014-01-01T00:00:00',
                                '2015-04-25T00:13:26.017995', -1, 1, 1)
    assert df['LoggedDate'].count() > 100
    assert len(df['faultName'].unique()) >= 10

    df1 = vobcDA.get_count_trend(-1, '2014-01-01T00:00:00',
                                 '2015-04-25T00:13:26.017995', 2, 0, 0)
    assert util.IsInMemoryTrue(
        df['LoggedDate'].count() > df1['LoggedDate'].count())
Exemplo n.º 9
0
def test_get_fc_trend():
    df = vobcDA.get_count_trend(-1, '2014-01-01T00:00:00',
                                '2015-04-25T00:13:26.017995', -1)
    #y_max = df.groupby(['LoggedDate']).max().max() * 1.01
    assert df['LoggedDate'].count() > 100
    assert len(df['faultName'].unique()) == 15

    df1 = vobcDA.get_count_trend(3, '2014-01-01T00:00:00',
                                 '2015-04-25T00:13:26.017995', -1)
    assert util.IsInMemoryTrue(
        df['LoggedDate'].count() > df1['LoggedDate'].count())
Exemplo n.º 10
0
def test_get_count_by_fc():
    df_all = vobcDA.get_count_by(-1, '2015-01-01T00:00:00',
                                 '2020-04-25T00:13:26.017995', 1, 1)
    df_one = vobcDA.get_count_by(3, '2015-01-01T00:00:00',
                                 '2020-04-25T00:13:26.017995', 0, 0)
    df_ = vobcDA.get_count_by(3, '2015-01-01T00:00:00',
                              '2020-04-25T00:13:26.017995')
    assert df_all['FaultCount'].count() > 0
    assert df_one['FaultCount'].count() > 0
    assert df_['FaultCount'].count() > 0
    assert util.IsInMemoryTrue(
        df_all['FaultCount'].count() > df_one['FaultCount'].count())
Exemplo n.º 11
0
def test_get_first_fault_time():
    dt = vobcDA.get_first_fault_time('2015-07-03', 3, 78)
    assert util.IsInMemoryTrue(dt.year == 2015)
def test_get_fc_list_faultcode_vobc_3():
    df = module_commLoss.get_commLoss_list('2015-01-01T10:00','2015-01-01T20:00', 248, None, 0, 0, 0)
    assert util.IsInMemoryTrue(len(df) >= 0)
def test_get_fc_list_faultcode_vobc_2():
    df = module_commLoss.get_commLoss_list('2015-01-01T10:00','2015-01-01T20:00', 248 , None, 1, 1, 1)
    assert df['loggedAt'].count() > 0
    dfVobc = df['vobcid'].unique()
    assert util.IsInMemoryTrue(len(dfVobc) == 1)
    assert util.IsInMemoryTrue(dfVobc[0] == 248)
Exemplo n.º 14
0
def test_get_faultcount_by_vobcid_loc_3():
    x = module_vobcfault.get_faultcount_by_vobcid_loc(filter_start_date,
                                                      filter_end_date, 3, 1, 1)
    assert util.IsInMemoryTrue(len(x.index) == 300)
    assert len(x.index) >= 100