Skip to content

Commit a6828a7

Browse files
committed
added test
Signed-off-by: bigcat88 <bigcat88@icloud.com>
1 parent b36ed72 commit a6828a7

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests/actual_tests/files_test.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import math
33
import os
44
import zipfile
5-
from datetime import datetime
5+
from datetime import datetime, timedelta
66
from io import BytesIO
77
from pathlib import Path
88
from random import choice, randbytes
@@ -753,6 +753,15 @@ def test_find_files_listdir_depth(nc_any):
753753
assert len(result) == 4
754754

755755

756+
def test_find_files_datetime(nc_any):
757+
time_in_past = datetime.now() - timedelta(days=1)
758+
time_in_future = datetime.now() + timedelta(days=1)
759+
assert len(nc_any.files.find(["gt", "last_modified", time_in_past], "/test_dir/subdir/"))
760+
assert not len(nc_any.files.find(["gt", "last_modified", time_in_future], "/test_dir/subdir/"))
761+
assert not len(nc_any.files.find(["lt", "last_modified", time_in_past], "/test_dir/subdir/"))
762+
assert len(nc_any.files.find(["lt", "last_modified", time_in_future], "/test_dir/subdir/"))
763+
764+
756765
def test_listdir_depth(nc_any):
757766
result = nc_any.files.listdir("test_dir/", depth=1)
758767
result2 = nc_any.files.listdir("test_dir")

0 commit comments

Comments
 (0)