def test_rainforest_five(self): assert np.allclose(take_cmap_colors('cmr.rainforest', 5), [(0.0, 0.0, 0.0), (0.226123592, 0.124584033, 0.562997277), (0.0548210513, 0.515835251, 0.45667819), (0.709615979, 0.722863985, 0.0834727592), (1.0, 1.0, 1.0)])
def test_rainforest_five_8bit(self): assert np.allclose(take_cmap_colors('cmr.rainforest', 5, return_fmt='int'), [(0, 0, 0), (58, 32, 144), (14, 132, 116), (181, 184, 21), (255, 255, 255)])
def test_invalid_range(self): with pytest.raises(ValueError): take_cmap_colors('cmr.rainforest', 5, cmap_range=(-1, 1.5))
def test_rainforest_sub_five(self): assert (take_cmap_colors('cmr.rainforest', 5, cmap_range=(0.2, 0.8), return_fmt='hex') == ['#3E0374', '#10528A', '#0E8474', '#5CAD3C', '#D6BF4A'])
def test_rainforest_five_hex(self): assert (take_cmap_colors('cmr.rainforest', 5, return_fmt='hex') == ['#000000', '#3A2090', '#0E8474', '#B5B815', '#FFFFFF'])
def test_rainforest_all(self): assert np.allclose(take_cmap_colors('cmr.rainforest', None), cmr.rainforest.colors)
def test_rainforest_sub_five(self): assert (take_cmap_colors('cmr.rainforest', 5, (0.2, 0.8), True) == [ '#3e0374', '#10528a', '#0e8474', '#5cad3c', '#d6bf4a' ])
def test_rainforest_five_hex(self): assert (take_cmap_colors('cmr.rainforest', 5, return_hex=True) == [ '#000000', '#3a2090', '#0e8474', '#b5b815', '#ffffff' ])