@@ -443,17 +443,19 @@ def test_vline_datetime_string_annotation():
443443 fig .add_vline (x = "2018-09-24" , annotation_text = "test" )
444444 assert len (fig .layout .annotations ) == 1
445445 assert fig .layout .annotations [0 ].text == "test"
446+ assert fig .layout .annotations [0 ].x == "2018-09-24"
446447
447448
448449def test_hline_with_datetime_vline ():
449- """add_hline should still work alongside datetime vline usage ."""
450+ """numeric add_hline should still work with datetime x-axis ."""
450451 fig = go .Figure ()
451452 fig .add_trace (
452453 go .Scatter (x = ["2018-01-01" , "2018-06-01" , "2018-12-31" ], y = [1 , 2 , 3 ])
453454 )
454455 fig .add_hline (y = 2 , annotation_text = "hline test" )
455456 assert len (fig .layout .annotations ) == 1
456457 assert fig .layout .annotations [0 ].text == "hline test"
458+ assert fig .layout .annotations [0 ].y == 2
457459
458460
459461def test_vrect_datetime_string_annotation ():
@@ -465,6 +467,7 @@ def test_vrect_datetime_string_annotation():
465467 fig .add_vrect (x0 = "2018-03-01" , x1 = "2018-09-01" , annotation_text = "rect test" )
466468 assert len (fig .layout .annotations ) == 1
467469 assert fig .layout .annotations [0 ].text == "rect test"
470+ assert fig .layout .annotations [0 ].x == "2018-09-01"
468471
469472
470473def test_vline_datetime_object_annotation ():
@@ -483,6 +486,7 @@ def test_vline_datetime_object_annotation():
483486 fig .add_vline (x = datetime .datetime (2018 , 9 , 24 ), annotation_text = "dt test" )
484487 assert len (fig .layout .annotations ) == 1
485488 assert fig .layout .annotations [0 ].text == "dt test"
489+ assert fig .layout .annotations [0 ].x == datetime .datetime (2018 , 9 , 24 , 0 , 0 )
486490
487491
488492def test_vrect_datetime_object_annotation ():
@@ -505,4 +509,5 @@ def test_vrect_datetime_object_annotation():
505509 )
506510 assert len (fig .layout .annotations ) == 1
507511 assert fig .layout .annotations [0 ].text == "rect dt test"
512+ assert fig .layout .annotations [0 ].x == datetime .datetime (2018 , 9 , 1 )
508513
0 commit comments