MCPcopy Create free account
hub / github.com/ImageEngine/cortex / testWildcards

Method testWildcards

test/IECore/PathMatcherTest.py:134–164  ·  view source on GitHub ↗
( self )

Source from the content-addressed store, hash-verified

132 self.assertEqual( m.match( "/" ), IECore.PathMatcher.Result.NoMatch )
133
134 def testWildcards( self ) :
135
136 f = IECore.PathMatcher( [
137 "/a",
138 "/red*",
139 "/green*Bloke*",
140 "/somewhere/over/the/*",
141 "/somewhere/over/the/*/skies/are/blue",
142 ] )
143
144 for path, result in [
145 ( "/a", f.Result.ExactMatch ),
146 ( "/redBoots", f.Result.ExactMatch ),
147 ( "/red", f.Result.ExactMatch ),
148 ( "/redWellies", f.Result.ExactMatch ),
149 ( "/redWellies/in/puddles", f.Result.AncestorMatch ),
150 ( "/greenFatBloke", f.Result.ExactMatch ),
151 ( "/greenBloke", f.Result.ExactMatch ),
152 ( "/greenBlokes", f.Result.ExactMatch ),
153 ( "/somewhere/over/the/rainbow", f.Result.ExactMatch | f.Result.DescendantMatch ),
154 ( "/somewhere/over/the", f.Result.DescendantMatch ),
155 ( "/somewhere/over", f.Result.DescendantMatch ),
156 ( "/somewhere", f.Result.DescendantMatch ),
157 ( "/somewhere/over/the/rainbow/skies/are/blue", f.Result.ExactMatch | f.Result.AncestorMatch ),
158 ( "/somewhere/over/the/rainbow/skies/are", f.Result.DescendantMatch | f.Result.AncestorMatch ),
159 ( "/somewhere/over/the/astonExpressway/skies/are", f.Result.DescendantMatch | f.Result.AncestorMatch ),
160 ( "/somewhere/over/the/astonExpressway/skies/are/blue", f.Result.ExactMatch | f.Result.AncestorMatch ),
161 ( "/somewhere/over/the/astonExpressway/skies/are/grey", f.Result.AncestorMatch ),
162 ] :
163
164 self.assertEqual( f.match( path ), int( result ) )
165
166 def testWildcardsWithSiblings( self ) :
167

Callers

nothing calls this directly

Calls 2

matchMethod · 0.95
PathMatcherMethod · 0.80

Tested by

no test coverage detected