def test_last_tac(get_dataframe): """Test that last used TAC is right.""" tc = (get_dataframe(SubscriberTACs( "2016-01-01", "2016-01-02")).sort_values( by=["subscriber", "time"]).set_index("subscriber")) assert (tc.ix["zvaOknzKbEVD2eME"].tac.tolist()[-1] == get_dataframe( SubscriberTAC( "2016-01-01", "2016-01-02", method="last")).set_index("subscriber").ix["zvaOknzKbEVD2eME"].tac)
def test_subscriber_tacs(get_dataframe): """ Test that correct TACs are returned for one subscriber. """ tc = get_dataframe(SubscriberTACs("2016-01-01", "2016-01-02")).set_index("subscriber") tacs = sorted([ 42188591.0, 40909697.0, 48693702.0, 42188591.0, 92380772.0, 42188591.0 ]) assert sorted(tc.loc["1p4MYbA1Y4bZzBQa"].tac.tolist()) == tacs
def test_modal_tac(get_dataframe): """ Test that most common tacs are right. """ tc = get_dataframe(SubscriberTACs("2016-01-01", "2016-01-02")).set_index("subscriber") assert (tc.loc["0DB8zw67E9mZAPK2"].tac.mode()[0] == get_dataframe( SubscriberTAC( "2016-01-01", "2016-01-02")).set_index("subscriber").loc["0DB8zw67E9mZAPK2"].tac)
def test_subscriber_tacs(self): """ Test that correct TACs are returned for one subscriber. """ tc = (SubscriberTACs( "2016-01-01", "2016-01-02").get_dataframe().set_index("subscriber")) tacs = sorted([ 42188591.0, 40909697.0, 48693702.0, 42188591.0, 92380772.0, 42188591.0 ]) self.assertListEqual(sorted(tc.ix["1p4MYbA1Y4bZzBQa"].tac.tolist()), tacs)
def test_modal_tac(self): """ Test that most common tacs are right. """ tc = (SubscriberTACs( "2016-01-01", "2016-01-02").get_dataframe().set_index("subscriber")) self.assertEqual( tc.ix["0DB8zw67E9mZAPK2"].tac.mode()[0], SubscriberTAC("2016-01-01", "2016-01-02").get_dataframe().set_index( "subscriber").ix["0DB8zw67E9mZAPK2"].tac, )