• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pythonic_testcase.assert_equals函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pythonwhois.get_whois函数代码示例发布时间:2022-05-27
下一篇:
Python util.ensure_dir函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap