MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_cn

Function test_cn

lib/matplotlib/tests/test_colors.py:1242–1261  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1240
1241
1242def test_cn():
1243 matplotlib.rcParams['axes.prop_cycle'] = cycler('color',
1244 ['blue', 'r'])
1245 assert mcolors.to_hex("C0") == '#0000ff'
1246 assert mcolors.to_hex("C1") == '#ff0000'
1247
1248 matplotlib.rcParams['axes.prop_cycle'] = cycler('color',
1249 ['xkcd:blue', 'r'])
1250 assert mcolors.to_hex("C0") == '#0343df'
1251 assert mcolors.to_hex("C1") == '#ff0000'
1252 assert mcolors.to_hex("C10") == '#0343df'
1253 assert mcolors.to_hex("C11") == '#ff0000'
1254
1255 matplotlib.rcParams['axes.prop_cycle'] = cycler('color', ['8e4585', 'r'])
1256
1257 assert mcolors.to_hex("C0") == '#8e4585'
1258 # if '8e4585' gets parsed as a float before it gets detected as a hex
1259 # colour it will be interpreted as a very large number.
1260 # this mustn't happen.
1261 assert mcolors.to_rgb("C0")[0] != np.inf
1262
1263
1264def test_conversions():

Callers

nothing calls this directly

Calls 1

cyclerFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…