def test_select_period_7(self): selected_p7 = TsManagement.select_period(self.ts_one, -10, 6) selected_p7_bis = TsManagement.select_period(self.ts_one, 0, 7) selected_p7_ref = self.ts_one[0:4] self.assertTrue(np_equals(selected_p7_bis, selected_p7_ref) or not np_equals(selected_p7, selected_p7_ref), "Test7 Select period failed: constraints sd+ed => first points")
def test_select_period_6(self): selected_p6 = TsManagement.select_period(self.ts_one, 6, 12) selected_p6_bis = TsManagement.select_period(self.ts_one, 5, 13) selected_p6_ref = self.ts_one[3:7] self.assertTrue(np_equals(selected_p6_bis, selected_p6_ref) or not np_equals(selected_p6, selected_p6_ref), "Test6 Select period failed: constraints sd+ed => intermediate points")
def test_select_period_5(self): selected_p5 = TsManagement.select_period(self.ts_one, 98, 180) selected_p5_bis = TsManagement.select_period(self.ts_one, 98, 98) selected_p5_ref = self.ts_one[-1:] self.assertTrue(np_equals(selected_p5_bis, selected_p5_ref) or not np_equals(selected_p5, selected_p5_ref), "Test5 Select period failed: constraints sd+ed => last single point")
def test_select_period_4(self): selected_p4 = TsManagement.select_period(self.ts_one, 90, 91) selected_p4_bis = TsManagement.select_period(self.ts_one, 89, 90) selected_p4_ref = self.ts_one[-5:-4] self.assertTrue(np_equals(selected_p4_bis, selected_p4_ref) or not np_equals(selected_p4, selected_p4_ref), "Test4 Select period failed: constraints sd+ed => single point")
def test_select_period_3(self): selected_p3 = TsManagement.select_period(self.ts_one, 90, None) selected_p3_bis = TsManagement.select_period(self.ts_one, 89, None) selected_p3_ref = self.ts_one[-5:] self.assertTrue(np_equals(selected_p3_bis, selected_p3_ref) or not np_equals(selected_p3, selected_p3_ref), "Test3 Select period failed: sd constraint only")
def test_select_period_2(self): selected_p2 = TsManagement.select_period(self.ts_one, None, 18) selected_p2_bis = TsManagement.select_period(self.ts_one, None, 19) selected_p2_ref = self.ts_one[0:10] self.assertTrue(np_equals(selected_p2, selected_p2_bis) or not np_equals(selected_p2, selected_p2_ref), "Test2 Select period failed: ed constraint only")
def test_select_period(self): selected_p1 = TsManagement.select_period(self.ts_one, sd=None, ed=None) self.assertTrue(np_equals(self.ts_one, selected_p1), "Test1 Select period failed: no constraints")
def test_merge_3(self): ts_merge_duppl_test3 = TsManagement.merge(self.ts_one, self.ts_one[10:0:-1]) self.assertTrue(np_equals(ts_merge_duppl_test3, self.ts_one), "Test3 Merge failed: ignored dooblons")
def test_merge_2(self): ts_merge_duppl_test2_one = TsManagement.merge(self.ts_one, self.ts_one[0:10]) self.assertTrue(np_equals(ts_merge_duppl_test2_one, self.ts_one), "Test2 Merge failed: ignored dooblons")
def test_merge(self): ts_merge = TsManagement.merge(self.ts_one, self.ts_two) ts_merge_bis = TsManagement.merge(self.ts_one, self.ts_inverse) self.assertTrue(np_equals(ts_merge, ts_merge_bis), "Test1 Merge failed")
def test_sort(self): ts_two_sorted = TsManagement.sort(self.ts_two) self.assertTrue(np_equals(self.ts_inverse, ts_two_sorted))