Add a test for SMS features.

communication
junos 2021-08-18 15:28:46 +02:00
parent 1bc996413e
commit c88336481e
2 changed files with 17 additions and 4 deletions

View File

@ -17,11 +17,25 @@ FEATURES_CALLS = (
+ ["no_contacts"] + ["no_contacts"]
) )
# FEATURES_CALLS = ["no_all", # FEATURES_CALLS =
# ["no_calls_all",
# "no_incoming", "no_outgoing", "no_missed", # "no_incoming", "no_outgoing", "no_missed",
# "duration_total_incoming", "duration_total_outgoing", # "duration_total_incoming", "duration_total_outgoing",
# "duration_max_incoming", "duration_max_outgoing", # "duration_max_incoming", "duration_max_outgoing",
# "no_incoming_ratio", "no_outgoing_ratio"] # "no_incoming_ratio", "no_outgoing_ratio",
# "no_contacts"]
FEATURES_SMS = (
["no_sms_all"]
+ ["no_" + sms_type for sms_type in sms_types.values()]
+ ["no_" + sms_types.get(1) + "_ratio", "no_" + sms_types.get(2) + "_ratio"]
+ ["no_contacts"]
)
# FEATURES_SMS =
# ["no_sms_all",
# "no_received", "no_sent",
# "no_received_ratio", "no_sent_ratio",
# "no_contacts"]
def get_call_data(usernames: Collection) -> pd.DataFrame: def get_call_data(usernames: Collection) -> pd.DataFrame:

View File

@ -76,14 +76,13 @@ class CallsFeatures(unittest.TestCase):
def test_count_comms_calls(self): def test_count_comms_calls(self):
self.features = count_comms(self.calls) self.features = count_comms(self.calls)
print(self.features)
self.assertIsInstance(self.features, pd.DataFrame) self.assertIsInstance(self.features, pd.DataFrame)
self.assertCountEqual(self.features.columns.to_list(), FEATURES_CALLS) self.assertCountEqual(self.features.columns.to_list(), FEATURES_CALLS)
def test_count_comms_sms(self): def test_count_comms_sms(self):
self.features = count_comms(self.sms) self.features = count_comms(self.sms)
print(self.features)
self.assertIsInstance(self.features, pd.DataFrame) self.assertIsInstance(self.features, pd.DataFrame)
self.assertCountEqual(self.features.columns.to_list(), FEATURES_SMS)
def test_calls_sms_features(self): def test_calls_sms_features(self):
self.features_call_sms = calls_sms_features(self.calls, self.sms) self.features_call_sms = calls_sms_features(self.calls, self.sms)