Exemplo n.º 1
0
def test_char_class_match():
    assert_true( glob.match( 'test.html', '[Tt]est.html' ) )
    assert_true( glob.match( 'test.html', '[Tt][Ee][Ss][Tt].[Hh][Tt][Mm][Ll]' ) )
    assert_true( glob.match( 'test.html', '[Tt]e[Ss]t.[Hh]tm[Ll]' ) )
    assert_true( glob.match( 'test.html', 'test[.]html' ) )
    assert_true( glob.match( 'test.html', '[bfjlnprtvwz]est.html' ) )
    assert_true( glob.match( 'test.html', '[a-z]est.html' ) )
    assert_true( glob.match( 'test.html', '[r-u]est.html' ) )
    assert_true( glob.match( 'test.html', '[:a-su-z]est.html' ) )
Exemplo n.º 2
0
def test_double_star_wildcard_match():
    assert_true( glob.match( '/foo/bar/blatt.html', '**.html' ) )
    assert_true( glob.match( '/foo/bar/blatt.html', '/**.html' ) )
    assert_true( glob.match( '/foo/bar/blatt.html', '**/bar/blatt.html' ) )
    assert_true( glob.match( '/foo/bar/blatt.html', '**/blatt.html' ) )
    assert_true( glob.match( '/foo/bar/blatt.html', '**oo/**/bl**tml' ) )
    assert_true( glob.match( '/foo/bar/blatt.html', '/**/blatt.html' ) )
    assert_true( glob.match( '/foo/bar/blatt.html', '/**/**.html' ) )
Exemplo n.º 3
0
def test_single_star_wildcard_match():
    assert_true( glob.match( '/foo/bar/blatt.html', '/foo/bar/*.html' ) )
    assert_true( glob.match( '/foo/bar/blatt.html', '/*/bar/blatt.html' ) )
    assert_true( glob.match( '/foo/bar/blatt.html', '/*/*/blatt.html' ) )
    assert_true( glob.match( '/foo/bar/blatt.html', '/*/*/*.html' ) )
    assert_true( glob.match( '/foo/bar/blatt.html', '/*/*/bla*' ) )
    assert_true( glob.match( '/foo/bar/blatt.html', '/*/*/*' ) )
    assert_true( glob.match( '/foo/bar/blatt.html', '/*/*/*.html' ) )
Exemplo n.º 4
0
def test_char_wildcard_mismatch():
    assert_false( glob.match( 'test.html', 'test.html?' ) )
    assert_false( glob.match( 'test.html', '?test.html' ) )
    assert_false( glob.match( 'test.html', 'test??html' ) )
    assert_false( glob.match( 'test.html', '?.html' ) )
    assert_false( glob.match( 'test.html', '?e?.html' ) )
    assert_false( glob.match( 'test.html', 'test.?' ) )
    assert_false( glob.match( 'test.html', '??????????' ) )
Exemplo n.º 5
0
def test_complex_match():
    assert_true( glob.match( '/foo/bar/blatt/test.html', '**.{html,txt}' ) )
    assert_true( glob.match( '/foo/bar/blatt/test.html', '/*/**.{html,txt}' ) )
    assert_true( glob.match( '/foo/bar/blatt/test.html', '/*/**/te?t.{html,txt}' ) )
    assert_true( glob.match( '/foo/bar/blatt/test.html', '/*/**.{ht??,txt}' ) )
    assert_true( glob.match( '/foo/bar/blatt/test.html', '/*/**.{ht?,html}' ) )
    assert_true( glob.match( '/foo/bar/blatt/test.html', '**/[bc]a?/**/*.{txt,html}' ) )
Exemplo n.º 6
0
def test_sub_pattern_match():
    assert_true( glob.match( 'test.html', 'test.{html}' ) )
    assert_true( glob.match( 'test.html', 'test.{html,txt}' ) )
    assert_true( glob.match( 'test.html', '{te,tes}t.html' ) )
    assert_true( glob.match( 'test.html', 'test{.,_}{html,txt}' ) )
    assert_true( glob.match( '/foo/bar/blatt.html', '/foo/{foo,bar}/blatt.html' ) )
    assert_true( glob.match( '/foo/bar/blatt.html', '{/foo/bar,/fee/fie}/blatt.html' ) )
Exemplo n.º 7
0
def test_sub_pattern_mismatch():
    assert_false( glob.match( 'test.html', 'test.{xml}' ) )
    assert_false( glob.match( 'test.html', 'test.{xml,txt}' ) )
    assert_false( glob.match( 'test.html', 'test.{xml,txt}' ) )
    assert_false( glob.match( 'test.html', '{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,u,v,w,x,y,z}est.html' ) )
Exemplo n.º 8
0
def test_exact_mismatch():
    assert_false( glob.match( 'foo.html', 'bar.html' ) )
    assert_false( glob.match( 'test.html', 'est.html' ) )
    assert_false( glob.match( 'test.html', 'test.htm' ) )
    assert_false( glob.match( 'test.html', 'tes...tml' ) )
Exemplo n.º 9
0
def test_char_class_mismatch():
    assert_false( glob.match( 'test.html', '[xyz]est.html' ) )
    assert_false( glob.match( 'test.html', '[a-s]est.html' ) )
    assert_false( glob.match( 'test.html', '[u-z]est.html' ) )
    assert_false( glob.match( 'test.html', '[a-su-z]est.html' ) )
    assert_false( glob.match( 'test.html', '[:a-z]est.html' ) )
Exemplo n.º 10
0
def test_double_star_wildcard_mismatch():
    assert_false( glob.match( '/foo/bar/blatt.html', '**/foo/bar/blatt.html' ) )
    assert_false( glob.match( '/foo/bar/blatt.html', '**/foo/blatt.html' ) )
    assert_false( glob.match( '/foo/bar/blatt.html', '/foo/bar/blatt.html**' ) )
    assert_false( glob.match( '/foo/bar/blatt.html', '**.html**' ) )
Exemplo n.º 11
0
def test_single_star_wildcard_mismatch():
    assert_false( glob.match( '/foo/bar/blatt.html', '*.html' ) )
    assert_false( glob.match( '/foo/bar/blatt.html', '/foo/*.html' ) )
    assert_false( glob.match( '/foo/bar/blatt.html', '/*/blatt.html' ) )
    assert_false( glob.match( '/foo/bar/blatt.html', '/*/*/blatt.foo' ) )
    assert_false( glob.match( '/foo/bar/blatt.html', '/*/*/*.foo' ) )
Exemplo n.º 12
0
def test_exact_match():
    assert_true( glob.match( 'test.html', 'test.html' ) )
    assert_true( glob.match( 'foo.html', 'foo.html' ) )
    assert_true( glob.match( 'bar.html', 'bar.html' ) )
Exemplo n.º 13
0
def test_char_wildcard_match():
    assert_true( glob.match( 'test.html', 'tes?.html' ) )
    assert_true( glob.match( 'test.html', 'test.htm?' ) )
    assert_true( glob.match( 'test.html', 't?s?.?t?l' ) )
    assert_true( glob.match( 'test.html', '????.html' ) )
    assert_true( glob.match( 'test.html', '?????????' ) )