@@ -949,57 +949,6 @@ def test_change_epoch():
949
949
0.5 )
950
950
951
951
952
- def test_warn_notintervals ():
953
- dates = np .arange ('2001-01-10' , '2001-03-04' , dtype = 'datetime64[D]' )
954
- locator = mdates .AutoDateLocator (interval_multiples = False )
955
- locator .intervald [3 ] = [2 ]
956
- locator .create_dummy_axis ()
957
- locator .set_view_interval (mdates .date2num (dates [0 ]),
958
- mdates .date2num (dates [- 1 ]))
959
- with pytest .warns (UserWarning , match = "AutoDateLocator was unable" ) as rec :
960
- locs = locator ()
961
-
962
-
963
- def test_change_converter ():
964
- plt .rcParams ['date.converter' ] = 'concise'
965
- dates = np .arange ('2020-01-01' , '2020-05-01' , dtype = 'datetime64[D]' )
966
- fig , ax = plt .subplots ()
967
-
968
- ax .plot (dates , np .arange (len (dates )))
969
- fig .canvas .draw ()
970
- assert ax .get_xticklabels ()[0 ].get_text () == 'Jan'
971
- assert ax .get_xticklabels ()[1 ].get_text () == '15'
972
-
973
- plt .rcParams ['date.converter' ] = 'auto'
974
- fig , ax = plt .subplots ()
975
-
976
- ax .plot (dates , np .arange (len (dates )))
977
- fig .canvas .draw ()
978
- assert ax .get_xticklabels ()[0 ].get_text () == 'Jan 01 2020'
979
- assert ax .get_xticklabels ()[1 ].get_text () == 'Jan 15 2020'
980
- with pytest .warns (UserWarning ) as rec :
981
- plt .rcParams ['date.converter' ] = 'boo'
982
-
983
-
984
- def test_change_interval_multiples ():
985
- plt .rcParams ['date.interval_multiples' ] = False
986
- dates = np .arange ('2020-01-10' , '2020-05-01' , dtype = 'datetime64[D]' )
987
- fig , ax = plt .subplots ()
988
-
989
- ax .plot (dates , np .arange (len (dates )))
990
- fig .canvas .draw ()
991
- assert ax .get_xticklabels ()[0 ].get_text () == 'Jan 10 2020'
992
- assert ax .get_xticklabels ()[1 ].get_text () == 'Jan 24 2020'
993
-
994
- plt .rcParams ['date.interval_multiples' ] = 'True'
995
- fig , ax = plt .subplots ()
996
-
997
- ax .plot (dates , np .arange (len (dates )))
998
- fig .canvas .draw ()
999
- assert ax .get_xticklabels ()[0 ].get_text () == 'Jan 15 2020'
1000
- assert ax .get_xticklabels ()[1 ].get_text () == 'Feb 01 2020'
1001
-
1002
-
1003
952
def test_epoch2num ():
1004
953
mdates ._reset_epoch_test_example ()
1005
954
mdates .set_epoch ('0000-12-31' )
0 commit comments