File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 44 CondaPkg. add (" numpy" )
55
66 td = pyimport (" numpy" ). timedelta64
7+ get_unit (x) = pyconvert (String, pyimport (" numpy" ). datetime_data (x)[0 ])
78 @testset for x in [
89 - 1_000_000_000 ,
910 - 1_000_000 ,
3031 y2 = pytimedelta64 (Unit (x))
3132 @test pyeq (Bool, y, y2)
3233 @test pyeq (Bool, y, td (x, " $pyunit " ))
34+ @test get_unit (y) == " $pyunit "
35+ @test get_unit (y2) == " $pyunit "
3336 end
37+ x = pytimedelta64 (Second (60 ))
38+ @test get_unit (x) == " s"
39+ x = pytimedelta64 (Second (60 ); canonicalize = true )
40+ @test get_unit (x) == " m"
41+
42+ PythonCall. Convert. CANONICALIZE_TIMEDELTA64[] = true
43+ @test pyconvert (Dates. CompoundPeriod, pytimedelta64 (Second (60 )),). periods[1 ] isa Minute
44+ PythonCall. Convert. CANONICALIZE_TIMEDELTA64[] = false
45+ @test pyconvert (Dates. CompoundPeriod, pytimedelta64 (Second (60 )),). periods[1 ] isa Second
3446end
3547
3648@testitem " datetime64" begin
You can’t perform that action at this time.
0 commit comments