コード例 #1
0
 def test_index_datetime_binary_operator_b(self) -> None:
     index = IndexDateGO.from_date_range('2018-03-12', '2018-03-14')
     a1 = index + Index((1, 2, 3))
     self.assertEqual(a1.tolist(), [
         datetime.date(2018, 3, 13),
         datetime.date(2018, 3, 15),
         datetime.date(2018, 3, 17)
     ])
コード例 #2
0
    def test_index_datetime_binary_operator_a(self) -> None:
        index = IndexDateGO.from_date_range('2018-03-12', '2018-03-15')
        index.append('2018-03-16')

        self.assertEqual((index + 2).tolist(),
                [datetime.date(2018, 3, 14), datetime.date(2018, 3, 15), datetime.date(2018, 3, 16), datetime.date(2018, 3, 17), datetime.date(2018, 3, 18)])

        with self.assertRaises(NotImplementedError):
            _ = index @ []
コード例 #3
0
    def test_index_datetime_append_a(self) -> None:
        index = IndexDateGO.from_date_range('2018-03-12', '2018-03-14')
        with self.assertRaises(KeyError):
            index.append('2018-03-12')

        index.append('2018-03-11')

        self.assertEqual(index.values.tolist(),
                [datetime.date(2018, 3, 12),
                datetime.date(2018, 3, 13),
                datetime.date(2018, 3, 14),
                datetime.date(2018, 3, 11)])