本文整理汇总了Python中pythonic_testcase.assert_equals函数的典型用法代码示例。如果您正苦于以下问题:Python assert_equals函数的具体用法?Python assert_equals怎么用?Python assert_equals使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert_equals函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_parsing
def test_parsing(self):
self.assert_parse(None, None)
self.assert_parse(None, 'nil')
parsed_time = self._parse('23:59:59+01:00')
assert_equals(time(23, 59, 59, tzinfo=iso8601.FixedOffset(1, 0, '+01:00')), parsed_time)
parsed_time = self._parse('23:59:59-02:30')
assert_equals(time(23, 59, 59, tzinfo=iso8601.FixedOffset(-2, -30, '-02:30')), parsed_time)
开发者ID:FlightDataServices,项目名称:soapfish,代码行数:7,代码来源:time_test.py
示例2: test_can_specify_additional_custom_message
def test_can_specify_additional_custom_message(self):
try:
assert_not_raises(Exception, self._fail_with(ValueError), message='Foo')
except AssertionError as e:
assert_equals('unexpected exception ValueError(): Foo', exception_message(e))
else:
self.fail('test did not catch exception!')
开发者ID:FelixSchwarz,项目名称:pythonic-testcase,代码行数:7,代码来源:assert_not_raises_test.py
示例3: test_can_render_simple_element
def test_can_render_simple_element(self):
element = xsdspec.Element()
element.name = 'Name'
element.type = 'xs:string'
expected_xml = b'<element name="Name" type="xs:string"/>\n'
assert_equals(expected_xml, element.xml('element'))
开发者ID:FlightDataServices,项目名称:soapfish,代码行数:7,代码来源:xsdspec_element_test.py
示例4: test_fails_with_sensible_default_error_message
def test_fails_with_sensible_default_error_message(self):
try:
assert_not_raises(Exception, self._fail_with(ValueError))
except AssertionError as e:
assert_equals('unexpected exception ValueError()', exception_message(e))
else:
self.fail('test did not catch exception!')
开发者ID:FelixSchwarz,项目名称:pythonic-testcase,代码行数:7,代码来源:assert_not_raises_test.py
示例5: test_supports_very_distant_dates
def test_supports_very_distant_dates(self):
raise SkipTest('XSDDate can currently only represent the value range of datetime.date')
future = XSDDate(12345, 4, 21)
assert_equals(12345, future.year)
past = XSDDate(-12345, 4, 21)
assert_equals(-12345, past.year)
开发者ID:FlightDataServices,项目名称:soapfish,代码行数:7,代码来源:xsddate_test.py
示例6: test_accepts_plain_strings_even_if_subclassed
def test_accepts_plain_strings_even_if_subclassed(self):
class StringWithPattern(xsd.String):
pattern = r'[0-9]{3}'
self.xsd_type = StringWithPattern
stored = self.assert_can_set('123')
assert_equals('123', stored)
self.assert_can_not_set('abc')
self.assert_can_not_set('1234')
开发者ID:FlightDataServices,项目名称:soapfish,代码行数:8,代码来源:string_test.py
示例7: test_can_generate_code_for_two_schemas
def test_can_generate_code_for_two_schemas(self):
xml = utils.open_document("tests/assets/generation/multi_schema.wsdl")
code = wsdl2py.generate_code_from_wsdl(xml, "client")
schemas, symbols = generated_symbols(code)
assert_is_not_empty(schemas)
assert_length(4, symbols)
assert_equals(["A"], list(schemas[0].elements))
assert_equals(["B"], list(schemas[1].elements))
开发者ID:FlightDataServices,项目名称:soapfish,代码行数:8,代码来源:wsdl_code_test.py
示例8: test_can_omit_optional_attributes
def test_can_omit_optional_attributes(self):
instance = self.SampleType(name='someName')
element = etree.Element('sample')
instance.render(element, instance)
assert_equals('someName', element.get('name'))
assert_none(element.get('value'))
assert_none(element.get('type'))
开发者ID:FlightDataServices,项目名称:soapfish,代码行数:8,代码来源:xsd_attrs_code_test.py
示例9: test_can_generate_code_for_inheritance
def test_can_generate_code_for_inheritance(self):
xml = utils.open_document('tests/assets/generation/inheritance.wsdl')
code = wsdl2py.generate_code_from_wsdl(xml, 'client')
schemas, symbols = generated_symbols(code)
assert_is_not_empty(schemas)
assert_length(4, symbols)
assert_equals(['B', 'A'], list(schemas[0].elements))
assert_isinstance(schemas[0].elements['B']._type, xsd.String)
assert_isinstance(schemas[0].elements['A']._type, schemas[0].elements['B']._type.__class__)
开发者ID:FlightDataServices,项目名称:soapfish,代码行数:9,代码来源:wsdl_code_test.py
示例10: test_can_lookup_element_by_name
def test_can_lookup_element_by_name(self):
ns = 'http://soap.example/schema.xsd'
class CodeType(xsd.String):
pattern = r'[0-9]{5}'
schema = xsd.Schema(ns,
location=ns,
elementFormDefault=xsd.ElementFormDefault.QUALIFIED,
simpleTypes=[CodeType],
elements={'code': xsd.Element(CodeType)}
)
schema_element = schema.get_element_by_name('code')
assert_equals(CodeType, schema_element._passed_type)
assert_none(schema.get_element_by_name('invalid'))
开发者ID:FlightDataServices,项目名称:soapfish,代码行数:15,代码来源:schema_test.py
示例11: test_can_render_references_to_groups
def test_can_render_references_to_groups(self):
class Person(xsd.Group):
name = xsd.Element(xsd.String)
class Job(xsd.ComplexType):
title = xsd.Element(xsd.String)
person = xsd.Ref(Person)
job = Job()
job.person = Person(name=u'Foo Bar')
assert_equals(u'Foo Bar', job.person.name)
# TODO: actually I think the current state is invalid as title is missing?
expected_xml = (
b'<job>\n'
b' <name>Foo Bar</name>\n'
b'</job>\n'
)
assert_equals(expected_xml, job.xml('job'))
开发者ID:FlightDataServices,项目名称:soapfish,代码行数:18,代码来源:xsd_ref_test.py
示例12: test_can_render_references_to_complex_types
def test_can_render_references_to_complex_types(self):
class Person(xsd.ComplexType):
name = xsd.Element(xsd.String)
class Job(xsd.ComplexType):
title = xsd.Element(xsd.String)
person = xsd.Ref(Person)
job = Job()
job.person = Person(name=u'Foo Bar')
assert_equals(u'Foo Bar', job.person.name)
expected_xml = (
b'<job>\n'
b' <person>\n'
b' <name>Foo Bar</name>\n'
b' </person>\n'
b'</job>\n'
)
assert_equals(expected_xml, job.xml('job'))
开发者ID:FlightDataServices,项目名称:soapfish,代码行数:19,代码来源:xsd_ref_test.py
示例13: test_can_render_elements_with_anonymous_simple_types
def test_can_render_elements_with_anonymous_simple_types(self):
element = xsdspec.Element()
element.name = 'versionNumber'
element.simpleType = xsdspec.SimpleType(
restriction=xsdspec.Restriction(
base='string',
pattern=xsdspec.Pattern(value='\d{2}\.\d{1,2}')
)
)
expected_xml = (
b'<element name="versionNumber">\n'
b' <simpleType>\n'
b' <restriction base="string">\n'
b' <pattern value="\d{2}\.\d{1,2}"/>\n'
b' </restriction>\n'
b' </simpleType>\n'
b'</element>\n'
)
assert_equals(expected_xml, element.xml('element'))
开发者ID:FlightDataServices,项目名称:soapfish,代码行数:19,代码来源:xsdspec_element_test.py
注:本文中的pythonic_testcase.assert_equals函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论