match: add doctest examples for patkind()
authorDenis Laxalde <denis@laxalde.org>
Sat, 06 Apr 2019 17:54:13 +0200
changeset 42082 413a75da98ce
parent 42081 bf777c1e78dd
child 42083 bee1647578b7
match: add doctest examples for patkind()
mercurial/match.py
--- a/mercurial/match.py	Sat Apr 06 15:21:55 2019 +0200
+++ b/mercurial/match.py	Sat Apr 06 17:54:13 2019 +0200
@@ -1024,7 +1024,18 @@
         return ('<unionmatcher matchers=%r>' % self._matchers)
 
 def patkind(pattern, default=None):
-    '''If pattern is 'kind:pat' with a known kind, return kind.'''
+    '''If pattern is 'kind:pat' with a known kind, return kind.
+
+    >>> patkind('re:.*\.c$')
+    're'
+    >>> patkind('glob:*.c')
+    'glob'
+    >>> patkind('relpath:test.py')
+    'relpath'
+    >>> patkind('main.py')
+    >>> patkind('main.py', default='re')
+    're'
+    '''
     return _patsplit(pattern, default)[0]
 
 def _patsplit(pattern, default):