本文整理汇总了Python中spec.eq_函数的典型用法代码示例。如果您正苦于以下问题:Python eq_函数的具体用法?Python eq_怎么用?Python eq_使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eq_函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: positionalness_and_optionalness_stick_together
def positionalness_and_optionalness_stick_together(self):
# TODO: but do these even make sense on the same argument? For now,
# best to have a nonsensical test than a missing one...
eq_(
repr(Argument('name', optional=True, positional=True)),
"<Argument: name *?>",
)
开发者ID:brutus,项目名称:invoke,代码行数:7,代码来源:argument.py
示例2: multiple_short_flags_adjacent
def multiple_short_flags_adjacent(self):
"mytask -bv (and inverse)"
for args in ('-bv', '-vb'):
r = self._parse("mytask %s" % args)
a = r[0].args
eq_(a.b.value, True)
eq_(a.v.value, True)
开发者ID:jthigpen,项目名称:invoke,代码行数:7,代码来源:cli.py
示例3: core_help_option_prints_core_help
def core_help_option_prints_core_help(self):
# TODO: change dynamically based on parser contents?
# e.g. no core args == no [--core-opts],
# no tasks == no task stuff?
# NOTE: test will trigger default pty size of 80x24, so the below
# string is formatted appropriately.
# TODO: add more unit-y tests for specific behaviors:
# * fill terminal w/ columns + spacing
# * line-wrap help text in its own column
expected = """
Usage: inv[oke] [--core-opts] task1 [--task1-opts] ... taskN [--taskN-opts]
Core options:
--no-dedupe Disable task deduplication.
-c STRING, --collection=STRING Specify collection name to load. May be
given >1 time.
-e, --echo Echo executed commands before running.
-h [STRING], --help[=STRING] Show core or per-task help and exit.
-H STRING, --hide=STRING Set default value of run()'s 'hide' kwarg.
-l, --list List available tasks.
-p, --pty Use a pty when executing shell commands.
-r STRING, --root=STRING Change root directory used for finding task
modules.
-V, --version Show version and exit.
-w, --warn-only Warn, instead of failing, when shell
commands fail.
""".lstrip()
r1 = run("inv -h", hide='out')
r2 = run("inv --help", hide='out')
eq_(r1.stdout, expected)
eq_(r2.stdout, expected)
开发者ID:jthigpen,项目名称:invoke,代码行数:32,代码来源:cli.py
示例4: submodule_names_are_stripped_to_last_chunk
def submodule_names_are_stripped_to_last_chunk(self):
with support_path():
from package import module
c = Collection.from_module(module)
eq_(module.__name__, 'package.module')
eq_(c.name, 'module')
assert 'mytask' in c # Sanity
开发者ID:techniq,项目名称:invoke,代码行数:7,代码来源:collection.py
示例5: default_tasks
def default_tasks(self):
# sub-ns default task display as "real.name (collection name)"
expected = self._listing(
'top_level (othertop)',
'sub.sub_task (sub, sub.othersub)',
)
eq_(run("invoke -c explicit_root --list").stdout, expected)
开发者ID:jthigpen,项目名称:invoke,代码行数:7,代码来源:cli.py
示例6: searches_towards_root_of_filesystem
def searches_towards_root_of_filesystem(self):
# Loaded while root is in same dir as .py
directly = self.l.load('foo')
# Loaded while root is multiple dirs deeper than the .py
deep = os.path.join(support, 'ignoreme', 'ignoremetoo')
indirectly = FSLoader(start=deep).load('foo')
eq_(directly, indirectly)
开发者ID:jordoncm,项目名称:invoke,代码行数:7,代码来源:loader.py
示例7: arguments_which_take_values_get_defaults_overridden_correctly
def arguments_which_take_values_get_defaults_overridden_correctly(self):
args = (Argument('arg', kind=str), Argument('arg2', kind=int))
c = Context('mytask', args=args)
argv = ['mytask', '--arg', 'myval', '--arg2', '25']
result = Parser((c,)).parse_argv(argv)
eq_(result[0].args['arg'].value, 'myval')
eq_(result[0].args['arg2'].value, 25)
开发者ID:B-Rich,项目名称:invoke,代码行数:7,代码来源:parser.py
示例8: unsets_aliases
def unsets_aliases(self):
ad = AliasDict()
ad['realkey'] = 'value'
ad.alias('myalias', to='realkey')
eq_(ad['myalias'], 'value')
ad.unalias('myalias')
assert 'myalias' not in ad
开发者ID:B-Rich,项目名称:lexicon,代码行数:7,代码来源:alias_dict.py
示例9: comparison_looks_at_merged_config
def comparison_looks_at_merged_config(self):
c1 = Config(defaults={'foo': {'bar': 'biz'}})
# Empty defaults to suppress global_defaults
c2 = Config(defaults={}, overrides={'foo': {'bar': 'biz'}})
ok_(c1 is not c2)
ok_(c1._defaults != c2._defaults)
eq_(c1, c2)
开发者ID:gtback,项目名称:invoke,代码行数:7,代码来源:config.py
示例10: can_clone_into_a_subclass
def can_clone_into_a_subclass(self):
orig = Call(self.task)
class MyCall(Call):
pass
clone = orig.clone(into=MyCall)
eq_(clone, orig)
ok_(isinstance(clone, MyCall))
开发者ID:brutus,项目名称:invoke,代码行数:7,代码来源:tasks.py
示例11: deletion_is_recursive
def deletion_is_recursive(self):
ad = self._recursive_aliases()
del ad['alias2']
assert 'realkey' not in ad
ad['realkey'] = 'newvalue'
assert 'alias1' in ad
eq_(ad['alias1'], 'newvalue')
开发者ID:B-Rich,项目名称:lexicon,代码行数:7,代码来源:alias_dict.py
示例12: multiple_short_flags_adjacent
def multiple_short_flags_adjacent(self):
"mytask -bv (and inverse)"
for args in ("-bv", "-vb"):
r = self._parse("mytask {0}".format(args))
a = r[0].args
eq_(a.b.value, True)
eq_(a.v.value, True)
开发者ID:simudream,项目名称:invoke,代码行数:7,代码来源:cli.py
示例13: ensure_deepcopy_works
def ensure_deepcopy_works(self):
ad = AttributeDict()
ad['foo'] = 'bar'
eq_(ad.foo, 'bar')
ad2 = copy.deepcopy(ad)
ad2.foo = 'biz'
assert ad2.foo != ad.foo
开发者ID:dstufft,项目名称:lexicon,代码行数:7,代码来源:attribute_dict.py
示例14: simple_command
def simple_command(self):
group = Group('localhost', '127.0.0.1')
result = group.run('echo foo', hide=True)
eq_(
[x.stdout.strip() for x in result.values()],
['foo', 'foo'],
)
开发者ID:bossjones,项目名称:fabric,代码行数:7,代码来源:group.py
示例15: return_code_in_result
def return_code_in_result(self):
"""
Result has .return_code (and .exited) containing exit code int
"""
r = run(self.out, hide='both')
eq_(r.return_code, 0)
eq_(r.exited, 0)
开发者ID:Web5design,项目名称:invoke,代码行数:7,代码来源:runner.py
示例16: env_vars_override_user
def env_vars_override_user(self):
os.environ['OUTER_INNER_HOORAY'] = 'env'
c = Config(
user_prefix=join(CONFIGS_PATH, 'yaml', 'invoke'),
)
c.load_shell_env()
eq_(c.outer.inner.hooray, 'env')
开发者ID:gtback,项目名称:invoke,代码行数:7,代码来源:config.py
示例17: replaced_stdin_objects_dont_explode
def replaced_stdin_objects_dont_explode(self, mock_sys):
# Replace sys.stdin with an object lacking .fileno(), which
# normally causes an AttributeError unless we are being careful.
mock_sys.stdin = object()
# Test. If bug is present, this will error.
runner = Local(Context())
eq_(runner.should_use_pty(pty=True, fallback=True), False)
开发者ID:tyewang,项目名称:invoke,代码行数:7,代码来源:runners.py
示例18: release_line_bugfix_specifier
def release_line_bugfix_specifier(self):
b50 = b(50)
b42 = b(42, spec='1.1+')
f25 = f(25)
b35 = b(35)
b34 = b(34)
f22 = f(22)
b20 = b(20)
c = changelog2dict(releases(
'1.2.1', '1.1.2', '1.0.3',
b50, b42,
'1.2.0', '1.1.1', '1.0.2',
f25, b35, b34,
'1.1.0', '1.0.1',
f22, b20
))
for rel, issues in (
('1.0.1', [b20]),
('1.1.0', [f22]),
('1.0.2', [b34, b35]),
('1.1.1', [b34, b35]),
('1.2.0', [f25]),
('1.0.3', [b50]), # the crux - is not b50 + b42
('1.1.2', [b50, b42]),
('1.2.1', [b50, b42]),
):
eq_(set(c[rel]), set(issues))
开发者ID:bitprophet,项目名称:releases,代码行数:27,代码来源:organization.py
示例19: release_line_bugfix_specifier
def release_line_bugfix_specifier(self):
b50 = _issue('bug', '50')
b42 = _issue('bug', '42', line='1.1')
f25 = _issue('feature', '25')
b35 = _issue('bug', '35')
b34 = _issue('bug', '34')
f22 = _issue('feature', '22')
b20 = _issue('bug', '20')
c = _changelog2dict(_releases(
'1.2.1', '1.1.2', '1.0.3',
b50, b42,
'1.2.0', '1.1.1', '1.0.2',
f25, b35, b34,
'1.1.0', '1.0.1',
f22, b20
))
for rel, issues in (
('1.0.1', [b20]),
('1.1.0', [f22]),
('1.0.2', [b34, b35]),
('1.1.1', [b34, b35]),
('1.2.0', [f25]),
('1.0.3', [b50]), # the crux - is not b50 + b42
('1.1.2', [b50, b42]),
('1.2.1', [b50, b42]),
):
eq_(set(c[rel]), set(issues))
开发者ID:pombredanne,项目名称:releases,代码行数:27,代码来源:changelog.py
示例20: non_spurious_OSErrors_bubble_up
def non_spurious_OSErrors_bubble_up(self):
try:
self._run(_, pty=True)
except ThreadException as e:
e = e.exceptions[0]
eq_(e.type, OSError)
eq_(str(e.value), "wat")
开发者ID:simudream,项目名称:invoke,代码行数:7,代码来源:runners.py
注:本文中的spec.eq_函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论