Exemplo n.º 1
0
def test_filter_spaces(sp_arg, sp_src, sp_dest):
    """Tests for spaces argument. Replace spaces with the specified character """
    args = parser.parse_args(["-sp", sp_arg])
    filters = renamer.initfilters(args)
    dest = renamer.get_renames(sp_src, filters, args.extension, args.raw)
    print(dest)
    print(sp_dest)
    assert dest == sp_dest
Exemplo n.º 2
0
def test_filter_prepend(pre_arg, pre_src, pre_dest):
    """Tests for pre argument. Add text before filename """
    args = parser.parse_args(["-pre", *pre_arg])
    filters = renamer.initfilters(args)
    dest = renamer.get_renames(pre_src, filters, args.extension, args.raw)
    print(dest)
    print(pre_dest)
    assert dest == pre_dest
Exemplo n.º 3
0
def test_filter_postpend(post_arg, post_src, post_dest):
    """Tests for post argument. Add text after filename """
    args = parser.parse_args(["-post", *post_arg])
    filters = renamer.initfilters(args)
    dest = renamer.get_renames(post_src, filters, args.extension, args.raw)
    print(dest)
    print(post_dest)
    assert dest == post_dest
Exemplo n.º 4
0
def test_filter_bracr_extra(bracr_arg, bracr_src, bracr_dest):
    """ Extra tests for bracket remove.
    Test for:
    -   Nested brackets
    -   Multiple bracket combinations ("arcs")
    """
    args = parser.parse_args(['-bracr', *bracr_arg])
    filters = renamer.initfilters(args)
    dest = renamer.get_renames(bracr_src, filters, args.extension, args.raw)
    assert dest == bracr_dest
Exemplo n.º 5
0
def test_filter_bracr_count(bracr_arg, bracr_src, bracr_dest):
    """ Extra tests for bracket remove with counts.
    Test for:
    -   non-existant
    -   remove all
    -   matched brackets
    """
    args = parser.parse_args(["-bracr", *bracr_arg])
    filters = renamer.initfilters(args)
    dest = renamer.get_renames(bracr_src, filters, args.extension, args.raw)
    assert dest == bracr_dest
Exemplo n.º 6
0
def test_filter_raw(raw_arg, raw_src, raw_dest):
    """Tests for raw argument. Treat extensions as part of filename """
    args = parser.parse_args([*raw_arg])
    filters = renamer.initfilters(args)
    dest = renamer.get_renames(raw_src, filters, args.extension, args.raw)
    assert dest == raw_dest
Exemplo n.º 7
0
def test_filter_extension(ext_arg, ext_src, ext_dest):
    """Tests for extension argument. Remove/replace extensions in file """
    args = parser.parse_args([*ext_arg])
    filters = renamer.initfilters(args)
    dest = renamer.get_renames(ext_src, filters, args.extension, args.raw)
    assert dest == ext_dest
Exemplo n.º 8
0
def test_filter_sequence(seq_arg, seq_src, seq_dest):
    """Tests for sequence argument. Create a sequence of text for a file """
    args = parser.parse_args(['-seq', *seq_arg])
    filters = renamer.initfilters(args)
    dest = renamer.get_renames(seq_src, filters, args.extension, args.raw)
    assert dest == seq_dest
Exemplo n.º 9
0
def test_filter_regex(re_arg, re_src, re_dest):
    """Tests for regex argument. Replace text using regular expressions """
    args = parser.parse_args(['-re', *re_arg])
    filters = renamer.initfilters(args)
    dest = renamer.get_renames(re_src, filters, args.extension, args.raw)
    assert dest == re_dest
Exemplo n.º 10
0
def test_filter_bracr(bracr_arg, bracr_src, bracr_dest):
    """Tests for bracket remove argument. Remove specified bracket type """
    args = parser.parse_args(["-bracr", bracr_arg])
    filters = renamer.initfilters(args)
    dest = renamer.get_renames(bracr_src, filters, args.extension, args.raw)
    assert dest == bracr_dest
Exemplo n.º 11
0
def test_filter_shave(sh_arg, sh_src, sh_dest):
    """Tests for shave argument. Shave away portion of filename """
    args = parser.parse_args(["-sh", sh_arg])
    filters = renamer.initfilters(args)
    dest = renamer.get_renames(sh_src, filters, args.extension, args.raw)
    assert dest == sh_dest
Exemplo n.º 12
0
def test_filter_slice(sl_arg, sl_src, sl_dest):
    """Tests for slice argument. Slice portion of filename as the new name """
    args = parser.parse_args(["-sl", sl_arg])
    filters = renamer.initfilters(args)
    dest = renamer.get_renames(sl_src, filters, args.extension, args.raw)
    assert dest == sl_dest
Exemplo n.º 13
0
def test_filter_translate(tr_arg, tr_src, tr_dest):
    """Tests for translate argument. Translate characters from one to another """
    args = parser.parse_args(["-tr", *tr_arg])
    filters = renamer.initfilters(args)
    dest = renamer.get_renames(tr_src, filters, args.extension, args.raw)
    assert dest == tr_dest
Exemplo n.º 14
0
def test_filter_case(c_arg, c_src, c_dest):
    """Tests for case argument. Switch case depending on argument """
    args = parser.parse_args(["-c", c_arg])
    filters = renamer.initfilters(args)
    dest = renamer.get_renames(c_src, filters, args.extension, args.raw)
    assert dest == c_dest
Exemplo n.º 15
0
def test_filter_spaces_noarg():
    """Special test case for spaces without arguments (defaults to '_') """
    args = parser.parse_args(["-sp"])
    filters = renamer.initfilters(args)
    dest = renamer.get_renames(["file a", "file b"], filters, args.extension, args.raw)
    assert dest == ["file_a", "file_b"]