@@ -555,8 +555,8 @@ def angled_plane(azimuth, elevation, angle, x, y):
555555
556556
557557def test_xkcd ():
558- assert mcolors .to_hex ("blue" ) == "#0000ffff "
559- assert mcolors .to_hex ("xkcd:blue" ) == "#0343dfff "
558+ assert mcolors .to_hex ("blue" ) == "#0000ff "
559+ assert mcolors .to_hex ("xkcd:blue" ) == "#0343df "
560560
561561
562562def _sph2cart (theta , phi ):
@@ -607,8 +607,8 @@ def test_colormap_reversing():
607607def test_cn ():
608608 matplotlib .rcParams ['axes.prop_cycle' ] = cycler ('color' ,
609609 ['blue' , 'r' ])
610- assert mcolors .to_hex ("C0" ) == '#0000ffff '
611- assert mcolors .to_hex ("C1" ) == '#ff0000ff '
610+ assert mcolors .to_hex ("C0" ) == '#0000ff '
611+ assert mcolors .to_hex ("C1" ) == '#ff0000 '
612612
613613 matplotlib .rcParams ['axes.prop_cycle' ] = cycler ('color' ,
614614 ['xkcd:blue' , 'r' ])
@@ -622,10 +622,11 @@ def test_conversions():
622622 # alpha is properly set.
623623 assert_equal (mcolors .to_rgba ((1 , 1 , 1 ), .5 ), (1 , 1 , 1 , .5 ))
624624 # builtin round differs between py2 and py3.
625- assert_equal (mcolors .to_hex ((.7 , .7 , .7 )), "#b2b2b2ff " )
625+ assert_equal (mcolors .to_hex ((.7 , .7 , .7 )), "#b2b2b2 " )
626626 # hex roundtrip.
627627 hex_color = "#1234abcd"
628- assert_equal (mcolors .to_hex (mcolors .to_rgba (hex_color )), hex_color )
628+ assert_equal (mcolors .to_hex (mcolors .to_rgba (hex_color ), keep_alpha = True ),
629+ hex_color )
629630
630631
631632if __name__ == '__main__' :
0 commit comments