Skip to content

Commit

Permalink
add some trivial doctest examples
Browse files Browse the repository at this point in the history
  • Loading branch information
hjacobs committed Jun 24, 2015
1 parent e6fb892 commit 2dcefdb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pg_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ def get_valid_output_methods():


def output_method_is_valid(method):
'''
>>> output_method_is_valid('foo')
False
>>> output_method_is_valid('curses')
True
'''
return method in get_valid_output_methods()


Expand Down Expand Up @@ -2894,6 +2900,12 @@ def get_postmasters_directories():


def get_dbname_from_path(db_path):
'''
>>> get_dbname_from_path('foo')
'foo'
>>> get_dbname_from_path('/pgsql_bar/9.4/data')
'bar'
'''
m = re.search(r'/pgsql_(.*?)(/\d+.\d+)?/data/?', db_path)
if m:
dbname = m.group(1)
Expand Down

0 comments on commit 2dcefdb

Please sign in to comment.