def test_refresh_with_manual_color(): color = ['red', 'green', 'blue'] features = pd.DataFrame(index=range(3)) text_manager = TextManager(color=color, features=features) text_manager.color = ['green', 'cyan', 'yellow'] text_manager.refresh(features) actual = text_manager.color._values assert_colors_equal(actual, ['green', 'cyan', 'yellow'])
def test_refresh_with_constant_color(): color = {'constant': 'red'} features = pd.DataFrame(index=range(3)) text_manager = TextManager(color=color, features=features) text_manager.color = {'constant': 'yellow'} text_manager.refresh(features) actual = text_manager.color._values assert_colors_equal(actual, 'yellow')
def test_equality(): n_text = 3 text = 'class' classes = np.array(['A', 'B', 'C']) properties = {'class': classes, 'confidence': np.array([0.5, 0.3, 1])} text_manager_1 = TextManager( text=text, n_text=n_text, properties=properties, color='red' ) text_manager_2 = TextManager( text=text, n_text=n_text, properties=properties, color='red' ) assert text_manager_1 == text_manager_2 assert not (text_manager_1 != text_manager_2) text_manager_2.color = 'blue' assert text_manager_1 != text_manager_2 assert not (text_manager_1 == text_manager_2)