@@ -45,38 +45,38 @@ def test_preprocessor_sequence(self):
4545 def test_compile_expansion_okay (self ):
4646 """Test expansion is okay."""
4747
48- self .assertEqual (len (_wcparse .compile ('{1..10}' , _wcparse .BRACE )), 10 )
48+ self .assertEqual (len (_wcparse .compile ([ '{1..10}' ] , _wcparse .BRACE )), 10 )
4949
5050 def test_compile_unique_optimization_okay (self ):
5151 """Test that redundant patterns are reduced in compile."""
5252
53- self .assertEqual (len (_wcparse .compile ('|' .join (['a' ] * 10 ), _wcparse .SPLIT , 10 )), 1 )
53+ self .assertEqual (len (_wcparse .compile ([ '|' .join (['a' ] * 10 )] , _wcparse .SPLIT , 10 )), 1 )
5454
5555 def test_translate_expansion_okay (self ):
5656 """Test expansion is okay."""
5757
58- p1 , p2 = _wcparse .translate ('{1..10}' , _wcparse .BRACE , 10 )
58+ p1 , p2 = _wcparse .translate ([ '{1..10}' ] , _wcparse .BRACE , 10 )
5959 count = len (p1 ) + len (p2 )
6060 self .assertEqual (count , 10 )
6161
6262 def test_translate_unique_optimization_okay (self ):
6363 """Test that redundant patterns are reduced in translate."""
64- p1 , p2 = _wcparse .translate ('|' .join (['a' ] * 10 ), _wcparse .SPLIT , 10 )
64+ p1 , p2 = _wcparse .translate ([ '|' .join (['a' ] * 10 )] , _wcparse .SPLIT , 10 )
6565 count = len (p1 ) + len (p2 )
6666 self .assertEqual (count , 1 )
6767
6868 def test_expansion_limt (self ):
6969 """Test expansion limit."""
7070
7171 with self .assertRaises (_wcparse .PatternLimitException ):
72- _wcparse .compile ('{1..11}' , _wcparse .BRACE , 10 )
72+ _wcparse .compile ([ '{1..11}' ] , _wcparse .BRACE , 10 )
7373
7474 with self .assertRaises (_wcparse .PatternLimitException ):
75- _wcparse .compile ('|' .join (['a' ] * 11 ), _wcparse .SPLIT , 10 )
75+ _wcparse .compile ([ '|' .join (['a' ] * 11 )] , _wcparse .SPLIT , 10 )
7676
7777 with self .assertRaises (_wcparse .PatternLimitException ):
7878 _wcparse .compile (
79- '{{{},{}}}' .format ('|' .join (['a' ] * 6 ), '|' .join (['a' ] * 5 )),
79+ [ '{{{},{}}}' .format ('|' .join (['a' ] * 6 ), '|' .join (['a' ] * 5 ))] ,
8080 _wcparse .SPLIT | _wcparse .BRACE , 10
8181 )
8282
@@ -90,14 +90,14 @@ def test_expansion_limt_translation(self):
9090 """Test expansion limit."""
9191
9292 with self .assertRaises (_wcparse .PatternLimitException ):
93- _wcparse .translate ('{1..11}' , _wcparse .BRACE , 10 )
93+ _wcparse .translate ([ '{1..11}' ] , _wcparse .BRACE , 10 )
9494
9595 with self .assertRaises (_wcparse .PatternLimitException ):
96- _wcparse .translate ('|' .join (['a' ] * 11 ), _wcparse .SPLIT , 10 )
96+ _wcparse .translate ([ '|' .join (['a' ] * 11 )] , _wcparse .SPLIT , 10 )
9797
9898 with self .assertRaises (_wcparse .PatternLimitException ):
9999 _wcparse .translate (
100- '{{{},{}}}' .format ('|' .join (['a' ] * 6 ), '|' .join (['a' ] * 5 )),
100+ [ '{{{},{}}}' .format ('|' .join (['a' ] * 6 ), '|' .join (['a' ] * 5 ))] ,
101101 _wcparse .SPLIT | _wcparse .BRACE , 10
102102 )
103103
@@ -110,12 +110,12 @@ def test_expansion_limt_translation(self):
110110 def test_expansion_no_limit_compile (self ):
111111 """Test no expansion limit compile."""
112112
113- self .assertEqual (len (_wcparse .compile ('{1..11}' , _wcparse .BRACE , - 1 )), 11 )
113+ self .assertEqual (len (_wcparse .compile ([ '{1..11}' ] , _wcparse .BRACE , - 1 )), 11 )
114114
115115 def test_expansion_no_limit_translate (self ):
116116 """Test no expansion limit translate."""
117117
118- p1 , p2 = _wcparse .translate ('{1..11}' , _wcparse .BRACE , 0 )
118+ p1 , p2 = _wcparse .translate ([ '{1..11}' ] , _wcparse .BRACE , 0 )
119119 count = len (p1 ) + len (p2 )
120120 self .assertEqual (count , 11 )
121121
@@ -158,3 +158,9 @@ def test_unc_pattern(self):
158158 _wcparse .RE_WIN_DRIVE [0 ].match ('//?/GLOBAL/UNC/server/mount/temp' ).group (0 ),
159159 '//?/GLOBAL/UNC/server/mount/'
160160 )
161+
162+ def test_bad_root_dir (self ):
163+ """Test bad root directory."""
164+
165+ with self .assertRaises (TypeError ):
166+ _wcparse .compile (['string' ], _wcparse .PATHNAME | _wcparse .REALPATH , 0 ).match ('string' , b'rdir' , None )
0 commit comments