def test_get_styled_text(): segment = { 'text': 'foo', 'style': 'ansi_code:' } assert prompt.fetch(segment) == 'ansi_code:foo'
def test_repository_dirty_symbol_color_is_mute(): with tempfile.TemporaryDirectory() as tmp_repo: empty_repo = git.Repo.init(tmp_repo) new_file = tempfile.NamedTemporaryFile(dir=tmp_repo) segment = repository.IsDirty(tmp_repo).segment() assert fetch(segment) in colorful.mute('*').styled_string new_file.close()
def test_current_working_path_color_is_info(): colors.load_theme() os.chdir(str(Path('/tmp'))) assert fetch( current_working_path.segment()) in colorful.info('/tmp').styled_string
def test_prompt_symbol_is_colored_for_failed_command(): colors.load_theme() symbol = prompt.fetch(prompt_symbol.segment(constants.FAIL)) assert symbol in colorful.danger('❯').styled_string
def test_prompt_symbol_is_colored_for_successful_command(): colors.load_theme() symbol = prompt.fetch(prompt_symbol.segment(constants.SUCCESS)) assert symbol in colorful.primary('❯').styled_string
def test_repository_active_branch_name_color_is_mute(): with tempfile.TemporaryDirectory() as tmp_repo: empty_repo = git.Repo.init(tmp_repo) segment = repository.ActiveBranch(tmp_repo).segment() assert fetch(segment) in colorful.mute('master').styled_string