コード例 #1
0
    def test_workspace_dates_empty(self):
        pass

        workspace = Workspace(self.test_dir)
        result = workspace.all_days()

        self.assertEqual(0, len(result))
コード例 #2
0
    def test_workspace_dates_dir_doesnt_count(self):
        dt = datetime.datetime(2000, 12, 31)
        self._dir('test', dt)

        workspace = Workspace(self.test_dir)
        result = workspace.all_days()

        self.assertEqual(0, len(result))
コード例 #3
0
    def test_workspace_dates_nested_file_doesnt_count(self):
        dt = datetime.datetime(2000, 12, 31)
        self._dir('testdir', dt)
        self._file(os.path.join('testdir', 'testfile'), dt)

        workspace = Workspace(self.test_dir)
        result = workspace.all_days()

        self.assertEqual(0, len(result))
コード例 #4
0
    def test_workspace_dates_single(self):
        dt = datetime.datetime(2000, 12, 31)
        self._file('test', dt)

        workspace = Workspace(self.test_dir)
        result = workspace.all_days()

        d = TestBackupRoll._dt2d(dt)
        self.assertSetEqual(set([d]), set(result))
        self.assertEqual(1, len(result))
コード例 #5
0
    def test_workspace_dates_no_offset_by_default(self):
        dt1 = datetime.datetime(2000, 12, 31, 0, 0, 0)
        dt2 = datetime.datetime(2000, 12, 31, 23, 59, 59)
        self._file('first', dt1)
        self._file('last', dt2)

        workspace = Workspace(self.test_dir)
        result = workspace.all_days()

        d = TestBackupRoll._dt2d(dt1)
        self.assertSetEqual(set([d]), set(result))
        self.assertEqual(1, len(result))
コード例 #6
0
    def test_workspace_dates_two(self):
        dt1 = datetime.datetime(2000, 12, 31)
        dt2 = datetime.datetime(2000, 12, 30)
        self._file('test1', dt1)
        self._file('test2', dt2)

        workspace = Workspace(self.test_dir)
        result = workspace.all_days()

        d1 = TestBackupRoll._dt2d(dt1)
        d2 = TestBackupRoll._dt2d(dt2)
        self.assertSetEqual(set([d1, d2]), set(result))
        self.assertEqual(2, len(result))
コード例 #7
0
    def test_workspace_dates_negative_offset(self):
        dt1 = datetime.datetime(2000, 12, 30, 1, 0, 0)
        dt2 = datetime.datetime(2000, 12, 31, 0, 59, 59)
        self._file('first', dt1)
        self._file('last', dt2)

        offset = -1
        workspace = Workspace(self.test_dir, offset)
        result = workspace.all_days()

        d = datetime.date(2000, 12, 30)
        self.assertSetEqual(set([d]), set(result))
        self.assertEqual(1, len(result))