本文整理汇总了Python中tests._util.eq_函数的典型用法代码示例。如果您正苦于以下问题:Python eq_函数的具体用法?Python eq_怎么用?Python eq_使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eq_函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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
示例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)
示例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'}}")
示例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)
示例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, [])
示例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
示例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))
示例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
示例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
示例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,))
示例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()))
示例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'])
示例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
示例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'])