本文整理汇总了Python中wrappers.expect_exact函数的典型用法代码示例。如果您正苦于以下问题:Python expect_exact函数的具体用法?Python expect_exact怎么用?Python expect_exact使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了expect_exact函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: step_send_source_command
def step_send_source_command(context):
with tempfile.NamedTemporaryFile() as f:
f.write(b'\?')
f.flush()
context.cli.sendline('\i {0}'.format(f.name))
wrappers.expect_exact(
context, context.conf['pager_boundary'] + '\r\n', timeout=5)
示例2: step_send_source_command
def step_send_source_command(context):
context.tmpfile_sql_help = tempfile.NamedTemporaryFile(prefix='pgcli_')
context.tmpfile_sql_help.write(b'\?')
context.tmpfile_sql_help.flush()
context.cli.sendline('\i {0}'.format(context.tmpfile_sql_help.name))
wrappers.expect_exact(
context, context.conf['pager_boundary'] + '\r\n', timeout=5)
示例3: step_see_container_unpaused
def step_see_container_unpaused(context, container_name):
"""
Check container is running.
"""
wrappers.expect_exact(context, container_name + '\r\n')
context.cli.sendline('ps')
wrappers.expect(context, r'Up [a-zA-Z0-9\s]+\s{2,}')
示例4: step_see_container_paused
def step_see_container_paused(context, container_name):
"""
Check container is paused.
"""
wrappers.expect_exact(context, container_name + '\r\n')
context.cli.sendline('ps')
wrappers.expect_exact(context, ' (Paused)')
示例5: step_edit_done_sql
def step_edit_done_sql(context):
for match in 'select * from abc'.split(' '):
wrappers.expect_exact(context, match, timeout=1)
# Cleanup the command line.
context.cli.sendcontrol('c')
# Cleanup the edited file.
if context.editor_file_name and os.path.exists(context.editor_file_name):
os.remove(context.editor_file_name)
示例6: step_db_drop
def step_db_drop(context):
"""Send drop database."""
context.cli.sendline('drop database {0};'.format(
context.conf['dbname_tmp']))
wrappers.expect_exact(
context, 'You\'re about to run a destructive command.\r\nDo you want to proceed? (y/n):', timeout=2)
context.cli.sendline('y')
示例7: step_see_prompt
def step_see_prompt(context):
"""Wait to see the prompt."""
user = context.conf['user']
host = context.conf['host']
dbname = context.currentdb
wrappers.expect_exact(context, '{0}@{1}:{2}> '.format(
user, host, dbname), timeout=5)
context.atprompt = True
示例8: step_see_large_results
def step_see_large_results(context):
rows = ['{n:3}| {n}'.format(n=str(n)) for n in range(1, 50)]
expected = ('***************************[ 1. row ]'
'***************************\r\n' +
'{}\r\n'.format('\r\n'.join(rows) + '\r\n'))
wrappers.expect_pager(context, expected, timeout=5)
wrappers.expect_exact(context, '1 row in set', timeout=2)
示例9: step_see_small_results
def step_see_small_results(context):
wrappers.expect_pager(context, dedent("""\
+---+\r
| 1 |\r
+---+\r
| 1 |\r
+---+\r
"""), timeout=5)
wrappers.expect_exact(context, '1 row in set', timeout=2)
示例10: step_send_help
def step_send_help(context):
"""Send \?
to see help.
"""
context.cli.sendline('\\?')
wrappers.expect_exact(
context, context.conf['pager_boundary'] + '\r\n', timeout=5)
示例11: step_query_select_123456
def step_query_select_123456(context):
context.cli.sendline('select 123456')
wrappers.expect_pager(context, dedent("""\
+--------+\r
| 123456 |\r
+--------+\r
| 123456 |\r
+--------+\r
"""), timeout=5)
wrappers.expect_exact(context, '1 row in set', timeout=2)
示例12: step_see_image_pulled
def step_see_image_pulled(context, image_name):
"""
Expect to see image pulled.
"""
wrappers.expect_exact(context, [
'Downloaded newer image for ' + image_name,
'Image is up to date for ' + image_name,
'Pull complete',
'Download complete'],
timeout=180)
示例13: step_see_null_selected
def step_see_null_selected(context):
"""Wait to see null output."""
wrappers.expect_pager(
context, dedent("""\
+--------+\r
| NULL |\r
+--------+\r
| <null> |\r
+--------+\r
"""), timeout=1)
wrappers.expect_exact(context, '1 row in set', timeout=2)
示例14: step_see_data_selected
def step_see_data_selected(context):
"""Wait to see select output."""
wrappers.expect_pager(
context, dedent("""\
+-----+\r
| x |\r
+-----+\r
| yyy |\r
+-----+\r
"""), timeout=1)
wrappers.expect_exact(context, '1 row in set', timeout=2)
示例15: step_edit_file
def step_edit_file(context):
"""Edit file with external editor."""
context.editor_file_name = os.path.join(
context.package_root, 'test_file_{0}.sql'.format(context.conf['vi']))
if os.path.exists(context.editor_file_name):
os.remove(context.editor_file_name)
context.cli.sendline('\e {0}'.format(
os.path.basename(context.editor_file_name)))
wrappers.expect_exact(
context, 'Entering Ex mode. Type "visual" to go to Normal mode.', timeout=2)
wrappers.expect_exact(context, '\r\n:', timeout=2)