def scan_event(item): """Progress event displayed each time a file is scanned""" if quiet or not item or not display_fn: return '' _scan_success, _scanned_path = item _scanned_path = unicode(toascii(_scanned_path)) if verbose: _progress_line = _scanned_path else: _progress_line = fixed_width_file_name(_scanned_path, max_file_name_len) return style('Scanned: ') + style(_progress_line, fg=_scan_success and 'green' or 'red')
def scan_event(item): """Progress event displayed each time a file is scanned""" if quiet or not item or not display_fn: return '' _scan_success, _scanned_path = item if verbose: _progress_line = _scanned_path else: _progress_line = fixed_width_file_name( _scanned_path, max_file_name_len) return style('Scanned: ') + style( _progress_line, fg=_scan_success and 'green' or 'red')
def test_fixed_width_file_name_with_none_filename_return_empty_string(self): test = fixed_width_file_name(None, 25) expected = '' assert expected == test
def test_fixed_width_file_name_without_extension(self): test = fixed_width_file_name('012345678901234567890123456', 25) expected = '01234567890...67890123456' assert expected == test
def test_fixed_width_file_name_with_file_name_at_max_length_is_not_shortened(self): test = fixed_width_file_name('01234567890123456789012.c', 25) expected = '01234567890123456789012.c' assert expected == test
def test_fixed_width_file_name_with_file_name_smaller_than_max_length_not_shortened(self): test = fixed_width_file_name('0123456789012345678901.c', 25) expected = '0123456789012345678901.c' assert expected == test
def test_fixed_width_file_name_with_file_name_larger_than_max_length_is_shortened(self): test = fixed_width_file_name('0123456789012345678901234.c', 25) expected = '0123456789...5678901234.c' assert expected == test
def test_fixed_width_file_name_with_file_name_smaller_than_max_length_is_not_shortened(self): file_name = '0123456789012345678901234.c' test = fixed_width_file_name(file_name, max_length=50) assert file_name == test
def test_fixed_width_file_name_with_very_small_file_name_and_long_extension(self): test = fixed_width_file_name('abc.abcdef', 5) # FIXME: what is expected is TBD expected = '' assert expected == test
def test_fixed_width_file_name_with_win_path_with_shortening(self): test = fixed_width_file_name('C\\:Documents_and_Settings\\Boki\\Desktop\\head\\patches\\drupal6\\012345678901234567890123.c', 25) expected = '0123456789...4567890123.c' assert expected == test
def test_fixed_width_file_name_with_win_path_without_shortening(self): test = fixed_width_file_name('C\\:Documents_and_Settings\\Boki\\Desktop\\head\\patches\\drupal6\\drupal.js', 25) expected = 'drupal.js' assert expected == test
def test_fixed_width_file_name_with_posix_path_with_shortening(self): test = fixed_width_file_name('C/Documents_and_Settings/Boki/Desktop/head/patches/drupal6/012345678901234567890123.c', 25) expected = '0123456789...4567890123.c' assert expected == test
def test_fixed_width_file_name_with_posix_path_without_shortening(self): test = fixed_width_file_name('C/Documents_and_Settings/Boki/Desktop/head/patches/drupal6/drupal.js', 25) expected = 'drupal.js' assert expected == test