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

        workspace = Workspace(self.test_dir)
        d = datetime.date(2000, 12, 30)
        result = workspace.list(d)

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

        workspace = Workspace(self.test_dir)
        d = datetime.date(2000, 12, 31)
        result = workspace.list(d)

        self.assertSetEqual(set([os.path.join(self.test_dir, 'test')]), set(result))
        self.assertEqual(1, len(result))
コード例 #3
0
    def test_workspace_list_uses_offset(self):
        dt1 = datetime.datetime(2000, 12, 30, 23, 0, 0)
        dt2 = datetime.datetime(2000, 12, 31, 22, 59, 59)
        dt3 = datetime.datetime(2000, 12, 31, 23, 0, 0)
        self._file('first', dt1)
        self._file('last', dt2)
        self._file('next', dt3)

        offset = 1
        workspace = Workspace(self.test_dir, offset)
        d = datetime.date(2000, 12, 31)
        result = workspace.list(d)

        self.assertSetEqual(set([
            os.path.join(self.test_dir, 'first'),
            os.path.join(self.test_dir, 'last'),
        ]), set(result))
        self.assertEqual(2, len(result))