@@ -516,7 +516,7 @@ def test_traits_datetime():
516
516
517
517
# 1. direction Python -> OData
518
518
519
- testdate = datetime (2005 , 1 , 28 , 18 , 30 , 44 , 123456 , tzinfo = timezone . utc )
519
+ testdate = datetime (2005 , 1 , 28 , 18 , 30 , 44 , 123456 , tzinfo = current_timezone () )
520
520
assert typ .traits .to_literal (testdate ) == "datetime'2005-01-28T18:30:44.123456'"
521
521
522
522
# without miliseconds part
@@ -539,19 +539,22 @@ def test_traits_datetime():
539
539
assert testdate .minute == 33
540
540
assert testdate .second == 6
541
541
assert testdate .microsecond == 654321
542
+ assert testdate .tzinfo == current_timezone ()
542
543
543
544
# parsing without miliseconds
544
545
testdate = typ .traits .from_literal ("datetime'1976-11-23T03:33:06'" )
545
546
assert testdate .year == 1976
546
547
assert testdate .second == 6
547
548
assert testdate .microsecond == 0
549
+ assert testdate .tzinfo == current_timezone ()
548
550
549
551
# parsing without seconds and miliseconds
550
552
testdate = typ .traits .from_literal ("datetime'1976-11-23T03:33'" )
551
553
assert testdate .year == 1976
552
554
assert testdate .minute == 33
553
555
assert testdate .second == 0
554
556
assert testdate .microsecond == 0
557
+ assert testdate .tzinfo == current_timezone ()
555
558
556
559
# parsing invalid value
557
560
with pytest .raises (PyODataModelError ) as e_info :
@@ -573,19 +576,22 @@ def test_traits_datetime():
573
576
assert testdate .minute == 33
574
577
assert testdate .second == 6
575
578
assert testdate .microsecond == 10000
579
+ assert testdate .tzinfo == current_timezone ()
576
580
577
581
# parsing without miliseconds
578
582
testdate = typ .traits .from_json ("/Date(217567986000)/" )
579
583
assert testdate .year == 1976
580
584
assert testdate .second == 6
581
585
assert testdate .microsecond == 0
586
+ assert testdate .tzinfo == current_timezone ()
582
587
583
588
# parsing without seconds and miliseconds
584
589
testdate = typ .traits .from_json ("/Date(217567980000)/" )
585
590
assert testdate .year == 1976
586
591
assert testdate .minute == 33
587
592
assert testdate .second == 0
588
593
assert testdate .microsecond == 0
594
+ assert testdate .tzinfo == current_timezone ()
589
595
590
596
# parsing the lowest value
591
597
with pytest .raises (OverflowError ):
@@ -599,6 +605,7 @@ def test_traits_datetime():
599
605
assert testdate .minute == 0
600
606
assert testdate .second == 0
601
607
assert testdate .microsecond == 0
608
+ assert testdate .tzinfo == current_timezone ()
602
609
603
610
# parsing the highest value
604
611
with pytest .raises (OverflowError ):
@@ -612,6 +619,7 @@ def test_traits_datetime():
612
619
assert testdate .minute == 59
613
620
assert testdate .second == 59
614
621
assert testdate .microsecond == 999000
622
+ assert testdate .tzinfo == current_timezone ()
615
623
616
624
# parsing invalid value
617
625
with pytest .raises (PyODataModelError ) as e_info :
0 commit comments