From c88336481e90f9e4844f5b3f25f9eafb476e65b3 Mon Sep 17 00:00:00 2001 From: junos Date: Wed, 18 Aug 2021 15:28:46 +0200 Subject: [PATCH] Add a test for SMS features. --- features/communication.py | 18 ++++++++++++++++-- test/test_communication.py | 3 +-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/features/communication.py b/features/communication.py index 30275d3..ded410c 100644 --- a/features/communication.py +++ b/features/communication.py @@ -17,11 +17,25 @@ FEATURES_CALLS = ( + ["no_contacts"] ) -# FEATURES_CALLS = ["no_all", +# FEATURES_CALLS = +# ["no_calls_all", # "no_incoming", "no_outgoing", "no_missed", # "duration_total_incoming", "duration_total_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: diff --git a/test/test_communication.py b/test/test_communication.py index 9e951d2..bbc0011 100644 --- a/test/test_communication.py +++ b/test/test_communication.py @@ -76,14 +76,13 @@ class CallsFeatures(unittest.TestCase): def test_count_comms_calls(self): self.features = count_comms(self.calls) - print(self.features) self.assertIsInstance(self.features, pd.DataFrame) self.assertCountEqual(self.features.columns.to_list(), FEATURES_CALLS) def test_count_comms_sms(self): self.features = count_comms(self.sms) - print(self.features) self.assertIsInstance(self.features, pd.DataFrame) + self.assertCountEqual(self.features.columns.to_list(), FEATURES_SMS) def test_calls_sms_features(self): self.features_call_sms = calls_sms_features(self.calls, self.sms)