本文整理汇总了Python中tests._util.eq_函数的典型用法代码示例。如果您正苦于以下问题:Python eq_函数的具体用法?Python eq_怎么用?Python eq_使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eq_函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_over_set_flat
def test_over_set_flat(self):
wanted = {u'x': 123, u'y': None}
pairs = ((u's_x', u'123'), (u's_z', u'nope'))
el = self.new_element()
el.set_flat(pairs)
eq_(el.value, wanted)
开发者ID:dag,项目名称:flatland,代码行数:7,代码来源:test_dicts.py
示例2: setup_package
def setup_package():
from flatland.schema import base
eq_(base.Element.__bases__, (base._BaseElement,))
import flatland.out.genshi
flatland.out.genshi.install_element_mixin()
assert len(base.Element.__bases__) == 2
开发者ID:dag,项目名称:flatland,代码行数:7,代码来源:__init__.py
示例3: test_full_set_flat
def test_full_set_flat(self):
wanted = {u'x': 101, u'y': 102}
pairs = ((u's_x', u'101'), (u's_y', u'102'))
el = self.new_element()
el.set_flat(pairs)
eq_(el.value, wanted)
开发者ID:dag,项目名称:flatland,代码行数:7,代码来源:test_dicts.py
示例4: test_nested_dict_as_unicode
def test_nested_dict_as_unicode():
schema = Dict.of(Dict.named(u'd').of(
Integer.named(u'x').using(default=10)))
el = schema.from_defaults()
eq_(el.value, {u'd': {u'x': 10}})
eq_(el.u, u"{u'd': {u'x': u'10'}}")
开发者ID:dag,项目名称:flatland,代码行数:7,代码来源:test_dicts.py
示例5: test_set_default
def test_set_default(self):
wanted = {u'x': 11, u'y': 12}
schema = self.new_schema()
schema.default = wanted
el = schema()
el.set_default()
eq_(el.value, wanted)
开发者ID:dag,项目名称:flatland,代码行数:8,代码来源:test_dicts.py
示例6: test_set_flat_miss
def test_set_flat_miss():
pairs = [(u'l_galump', u'3'), (u'l_snorgle', u'4')]
schema = List.named(u'l').of(Integer.named(u'i'))
el = schema.from_flat(pairs)
eq_(len(el), 0)
eq_(el.value, [])
开发者ID:dag,项目名称:flatland,代码行数:8,代码来源:test_lists.py
示例7: test_url_canonicalizer_want_all
def test_url_canonicalizer_want_all():
v = URLCanonicalizer(discard_parts=())
el = scalar('http://me:[email protected]/path#fragment')
eq_(el.value, 'http://me:[email protected]/path#fragment')
assert v.validate(el, None)
eq_(el.value, 'http://me:[email protected]/path#fragment')
assert not el.errors
开发者ID:mmerickel,项目名称:flatland,代码行数:8,代码来源:test_network.py
示例8: test_set_flat_linear
def test_set_flat_linear():
pairs = [(u'l_0_i', 1), (u'l_1_i', 2), (u'l_2_i', 3)]
schema = List.named(u'l').of(Integer.named(u'i'))
el = schema.from_flat(pairs)
eq_(len(el), len(pairs))
eq_(el.value, list(pair[1] for pair in pairs))
开发者ID:dag,项目名称:flatland,代码行数:8,代码来源:test_lists.py
示例9: test_url_canonicalizer_default
def test_url_canonicalizer_default():
v = URLCanonicalizer()
el = scalar('http://localhost/#foo')
eq_(el.value, 'http://localhost/#foo')
assert v.validate(el, None)
eq_(el.value, 'http://localhost/')
assert not el.errors
开发者ID:mmerickel,项目名称:flatland,代码行数:8,代码来源:test_network.py
示例10: test_descent
def test_descent(self):
schema = Dict.of(Integer).using(
descent_validators=[self.validator('1', True)])
el = schema()
assert not el.validate()
eq_(self.canary, ['1'])
assert el.valid
assert not el.all_valid
开发者ID:dag,项目名称:flatland,代码行数:8,代码来源:test_containers.py
示例11: teardown_package
def teardown_package():
from flatland.schema import base
assert len(base.Element.__bases__) == 2
import flatland.out.genshi
flatland.out.genshi.uninstall_element_mixin()
eq_(base.Element.__bases__, (base._BaseElement,))
开发者ID:dag,项目名称:flatland,代码行数:8,代码来源:__init__.py
示例12: same_
def same_(source, kw):
el = schema(source)
sliced = el.slice(**kw)
wanted = dict(keyslice_pairs(el.value.items(), **kw))
eq_(sliced, wanted)
eq_(set(type(_) for _ in sliced.keys()),
set(type(_) for _ in wanted.keys()))
开发者ID:dag,项目名称:flatland,代码行数:9,代码来源:test_dicts.py
示例13: test_http_validator_default
def test_http_validator_default():
v = HTTPURLValidator(forbidden_part='X')
el = scalar('http://there/path#fragment')
assert v.validate(el, None)
assert not el.errors
el = scalar('http://phis:[email protected]/path#fragment')
not v.validate(el, None)
eq_(el.errors, ['X'])
开发者ID:dag,项目名称:flatland,代码行数:9,代码来源:test_network.py
示例14: test_regular
def test_regular(self):
schema = (Dict.of(Integer).
using(validators=[self.validator('1', True)]))
el = schema()
assert not el.validate()
eq_(self.canary, ['1'])
assert el.valid
assert not el.all_valid
开发者ID:dag,项目名称:flatland,代码行数:9,代码来源:test_containers.py
示例15: test_url_validator_schemes
def test_url_validator_schemes():
v = URLValidator(allowed_schemes=(), blocked_scheme='X')
el = scalar('http://me:[email protected]/path#fragment')
assert not v.validate(el, None)
eq_(el.errors, ['X'])
v = URLValidator(allowed_schemes=('https',), blocked_scheme='X')
el = scalar('http://me:[email protected]/path#fragment')
assert not v.validate(el, None)
eq_(el.errors, ['X'])
开发者ID:mmerickel,项目名称:flatland,代码行数:10,代码来源:test_network.py
示例16: validate_element_set
def validate_element_set(type_, raw, value, uni, schema_opts={},
set_return=None):
if set_return is None:
set_return = value is not None
element = type_(**schema_opts)
eq_(element.set(raw), set_return)
eq_(element.value, value)
eq_(element.u, uni)
eq_(unicode(element), uni)
eq_(element.__nonzero__(), bool(uni and value))
开发者ID:gaconnet,项目名称:flatland,代码行数:10,代码来源:test_scalars.py
示例17: test_map_equal
def test_map_equal():
v = MapEqual('x', 'y',
transform=lambda el: el.value.upper(),
unequal='%(labels)s/%(last_label)s')
el = form(dict(x='a', y='A'))
assert v.validate(el, None)
el = form(dict(x='a', y='B'))
assert not v.validate(el, None)
eq_(el.errors, ['x/y'])
开发者ID:gaconnet,项目名称:flatland,代码行数:10,代码来源:test_scalars.py
示例18: test_set_flat_pruned
def test_set_flat_pruned():
sub = String.named(u's')
pairs = [(u's', u'val0'), (u's', ''), (u's', u'val1'), (u's', u'')]
wanted = [u'val0', u'val1']
for schema in Array.of(sub), Array.of(sub).using(prune_empty=True):
el = schema.from_flat(pairs)
eq_(len(el), len(wanted))
eq_(el.value, wanted)
开发者ID:dag,项目名称:flatland,代码行数:10,代码来源:test_arrays.py
示例19: test_straight_parse
def test_straight_parse():
form = SimpleForm1.from_flat(REQUEST_DATA)
eq_(set(form.flatten()), set(((u'fname', u'FN'),
(u'surname', u'SN'),
(u'age', u'99'))))
eq_(form.value, dict(fname=u'FN',
surname=u'SN',
age=99,
snacks=[]))
开发者ID:dag,项目名称:flatland,代码行数:10,代码来源:test_forms.py
示例20: test_half_set
def test_half_set(self):
wanted = {u'x': 123, u'y': None}
el = self.new_element()
el.set({u'x': 123})
eq_(el.value, wanted)
el = self.new_element()
el.set([(u'x', 123)])
eq_(el.value, wanted)
开发者ID:dag,项目名称:flatland,代码行数:10,代码来源:test_dicts.py
注:本文中的tests._util.eq_函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论