From 727171247e908a67cb7f93ae1b738e3ea62aa123 Mon Sep 17 00:00:00 2001 From: AntonioVitoMastromarino Date: Tue, 27 Feb 2024 15:21:57 +0000 Subject: [PATCH] style adjusted --- epios/sampling_maker.py | 4 ++-- epios/tests/test_re_scaler.py | 9 +++++---- epios/tests/test_sampling_maker.py | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/epios/sampling_maker.py b/epios/sampling_maker.py index c15c1aa..cdee216 100644 --- a/epios/sampling_maker.py +++ b/epios/sampling_maker.py @@ -48,7 +48,7 @@ def __init__(self, non_resp_rate=0, keep_track=False, data=None, self.keep_track = keep_track self.data = data - def __call__(self, sampling_times, people, post_proc = False): + def __call__(self, sampling_times, people, post_proc=False): ''' Method to return the results for all the planned tests @@ -85,7 +85,7 @@ def __call__(self, sampling_times, people, post_proc = False): temp = [] for x in res: for n, y in enumerate(temp): - temp[n] = y.drop(columns = x.columns, errors = 'ignore') + temp[n] = y.drop(columns=x.columns, errors='ignore') temp.append(x) result.append(temp.copy()) observ.append(list(map(lambda x: (x == 'Positive').mean().mean(), temp))) diff --git a/epios/tests/test_re_scaler.py b/epios/tests/test_re_scaler.py index 66e8fba..4ae333b 100644 --- a/epios/tests/test_re_scaler.py +++ b/epios/tests/test_re_scaler.py @@ -18,9 +18,10 @@ def test_call(self): def test_smooth(self): x = [[1.0], [1.0, 2.0], [1.0, 2.0, 3.0]] with self.assertRaises(Exception): - ReScaler(smoothing=lambda x: 1)(x, tested=[[1],[1,1],[1,1,1]]) + ReScaler(smoothing=lambda x: 1)(x, tested=[[1], [1, 1], [1, 1, 1]]) with self.assertRaises(Exception): ReScaler(smoothing=lambda x: 1)(x, times=array([0.0, 1.0, 2.0])) - self.assertEqual(ReScaler(smoothing=lambda x: 1)(x, times=array([0.0, 1.0, 2.0]), tested=[[1],[1,1],[1,1,1]])[0], 1.0) - self.assertEqual(ReScaler(smoothing=lambda x: 1)(x, times=array([0.0, 1.0, 2.0]), tested=[[1],[1,1],[1,1,1]])[1], 2.0) - self.assertEqual(ReScaler(smoothing=lambda x: 1)(x, times=array([0.0, 1.0, 2.0]), tested=[[1],[1,1],[1,1,1]])[2], 3.0) + result = ReScaler(smoothing=lambda x: 1)(x, times=array([0.0, 1.0, 2.0]), tested=[[1], [1, 1],[1, 1, 1]]) + self.assertEqual(result[0], 1.0) + self.assertEqual(result[1], 2.0) + self.assertEqual(result[2], 3.0) diff --git a/epios/tests/test_sampling_maker.py b/epios/tests/test_sampling_maker.py index a1b2c53..19106f6 100644 --- a/epios/tests/test_sampling_maker.py +++ b/epios/tests/test_sampling_maker.py @@ -1,10 +1,10 @@ import pandas as pd from unittest import TestCase from sampling_maker import SamplingMaker -from numpy import array class TestSM(TestCase): + def test_positive(self): self.assertEqual(SamplingMaker(threshold=1)._testresult(1.1), 'Positive') for a in [3, 4, 5, 6, 7, 8]: