@@ -134,7 +134,7 @@ def test_jpl_bar_units():
134134 day = units .Duration ("ET" , 24.0 * 60.0 * 60.0 )
135135 x = [0 * units .km , 1 * units .km , 2 * units .km ]
136136 w = [1 * day , 2 * day , 3 * day ]
137- b = units .Epoch ("ET" , dt = datetime (2009 , 4 , 25 ))
137+ b = units .Epoch ("ET" , dt = datetime (2009 , 4 , 26 ))
138138 fig , ax = plt .subplots ()
139139 ax .bar (x , w , bottom = b )
140140 ax .set_ylim ([b - 1 * day , b + w [- 1 ] + (1.001 ) * day ])
@@ -149,13 +149,24 @@ def test_jpl_barh_units():
149149 day = units .Duration ("ET" , 24.0 * 60.0 * 60.0 )
150150 x = [0 * units .km , 1 * units .km , 2 * units .km ]
151151 w = [1 * day , 2 * day , 3 * day ]
152- b = units .Epoch ("ET" , dt = datetime (2009 , 4 , 25 ))
152+ b = units .Epoch ("ET" , dt = datetime (2009 , 4 , 26 ))
153153
154154 fig , ax = plt .subplots ()
155155 ax .barh (x , w , left = b )
156156 ax .set_xlim ([b - 1 * day , b + w [- 1 ] + (1.001 ) * day ])
157157
158158
159+ def test_jpl_datetime_units_consistent ():
160+ import matplotlib .testing .jpl_units as units
161+ units .register ()
162+
163+ dt = datetime (2009 , 4 , 26 )
164+ jpl = units .Epoch ("ET" , dt = dt )
165+ dt_conv = munits .registry .get_converter (dt ).convert (dt , None , None )
166+ jpl_conv = munits .registry .get_converter (jpl ).convert (jpl , None , None )
167+ assert dt_conv == jpl_conv
168+
169+
159170def test_empty_arrays ():
160171 # Check that plotting an empty array with a dtype works
161172 plt .scatter (np .array ([], dtype = 'datetime64[ns]' ), np .array ([]))
0 commit comments