diff --git a/machine_learning/labels.py b/machine_learning/labels.py index 6e17c3e..7f30478 100644 --- a/machine_learning/labels.py +++ b/machine_learning/labels.py @@ -9,7 +9,7 @@ from pyprojroot import here import participants.query_db from features import esm from machine_learning import QUESTIONNAIRE_IDS, QUESTIONNAIRE_IDS_RENAME -from machine_learning.helper import to_csv_with_settings, read_csv_with_settings +from machine_learning.helper import read_csv_with_settings, to_csv_with_settings WARNING_PARTICIPANTS_LABEL = ( "Before aggregating labels, please set participants label using self.set_participants_label() " @@ -88,7 +88,7 @@ class Labels: self.folder, self.filename_prefix, data_type="_".join(self.questionnaires), - grouping_variable=self.grouping_variable + grouping_variable=self.grouping_variable, ) print("Read labels from the file.") except FileNotFoundError: diff --git a/test/test_esm.py b/test/test_esm.py index ddfee37..065bcf2 100644 --- a/test/test_esm.py +++ b/test/test_esm.py @@ -1,6 +1,7 @@ import unittest from pandas.testing import assert_series_equal +from pyprojroot import here from features.esm import * from features.esm_JCQ import * @@ -9,7 +10,7 @@ from features.esm_JCQ import * class EsmFeatures(unittest.TestCase): @classmethod def setUpClass(cls) -> None: - cls.esm = pd.read_csv("../data/example_esm.csv", sep=";") + cls.esm = pd.read_csv(here("data/example_esm.csv"), sep=";") cls.esm["esm_json"] = cls.esm["esm_json"].apply(eval) cls.esm_processed = preprocess_esm(cls.esm) cls.esm_clean = clean_up_esm(cls.esm_processed) diff --git a/test/test_features_sensor.py b/test/test_features_sensor.py index 3a9a215..8474f9b 100644 --- a/test/test_features_sensor.py +++ b/test/test_features_sensor.py @@ -18,8 +18,10 @@ class SensorFeaturesTest(unittest.TestCase): self.assertIsInstance(sensor_features_params, dict) self.assertIsInstance(sensor_features_params.get("grouping_variable"), str) self.assertIsInstance(sensor_features_params.get("features"), dict) - self.assertIsInstance(sensor_features_params.get("participants_usernames"), list) + self.assertIsInstance( + sensor_features_params.get("participants_usernames"), list + ) def test_participants_label(self): sensor_features = SensorFeatures(**self.sensor_features_params) - self.assertRaises(ValueError, sensor_features.calculate_features) \ No newline at end of file + self.assertRaises(ValueError, sensor_features.calculate_features) diff --git a/test/test_proximity.py b/test/test_proximity.py index 18fbf09..ec8da87 100644 --- a/test/test_proximity.py +++ b/test/test_proximity.py @@ -1,5 +1,7 @@ import unittest +from pyprojroot import here + from features.proximity import * @@ -10,7 +12,7 @@ class ProximityFeatures(unittest.TestCase): @classmethod def setUpClass(cls) -> None: - cls.df_proximity = pd.read_csv("../data/example_proximity.csv") + cls.df_proximity = pd.read_csv(here("data/example_proximity.csv")) cls.df_proximity["participant_id"] = 99 def test_recode_proximity(self):