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

Python encoder.encode函数代码示例

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

本文整理汇总了Python中pyasn1.codec.cer.encoder.encode函数的典型用法代码示例。如果您正苦于以下问题:Python encode函数的具体用法?Python encode怎么用?Python encode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了encode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: testFractionOfSecond

 def testFractionOfSecond(self):
     try:
         assert encoder.encode(
             useful.UTCTime('150501120112.10Z')
         )
     except PyAsn1Error:
         pass
     else:
         assert 0, 'Decimal point tolerated'
开发者ID:anthrotype,项目名称:pyasn1,代码行数:9,代码来源:test_encoder.py


示例2: testLocalTimezone

 def testLocalTimezone(self):
     try:
         assert encoder.encode(
             useful.UTCTime('150501120112+0200')
         )
     except PyAsn1Error:
         pass
     else:
         assert 0, 'Local timezone tolerated'
开发者ID:anthrotype,项目名称:pyasn1,代码行数:9,代码来源:test_encoder.py


示例3: testMissingTimezone

 def testMissingTimezone(self):
     try:
         assert encoder.encode(
             useful.GeneralizedTime('20150501120112.1')
         )
     except PyAsn1Error:
         pass
     else:
         assert 0, 'Missing timezone tolerated'
开发者ID:anthrotype,项目名称:pyasn1,代码行数:9,代码来源:test_encoder.py


示例4: testMissingTimezone

 def testMissingTimezone(self):
     try:
         assert encoder.encode(
             useful.UTCTime('150501120112')
         ) == ints2octs((23, 13, 49, 53, 48, 53, 48, 49, 49, 50, 48, 49, 49, 50, 90))
     except PyAsn1Error:
         pass
     else:
         assert 0, 'Missing timezone tolerated'
开发者ID:luke-chang,项目名称:gecko-1,代码行数:9,代码来源:test_encoder.py


示例5: testDecimalCommaPoint

 def testDecimalCommaPoint(self):
     try:
         assert encoder.encode(
                 useful.GeneralizedTime('20150501120112,1Z')
          )
     except PyAsn1Error:
         pass
     else:
         assert 0, 'Decimal comma tolerated'
开发者ID:luke-chang,项目名称:gecko-1,代码行数:9,代码来源:test_encoder.py


示例6: testWithUntaggedChoice

    def testWithUntaggedChoice(self):

        c = univ.Choice(
            componentType=namedtype.NamedTypes(
                namedtype.NamedType('premium', univ.Boolean())
            )
        )

        s = univ.Set(
            componentType=namedtype.NamedTypes(
                namedtype.NamedType('name', univ.OctetString()),
                namedtype.NamedType('customer', c)
            )
        )

        s.setComponentByName('name', 'A')
        s.getComponentByName('customer').setComponentByName('premium', True)

        assert encoder.encode(s) == ints2octs((49, 128, 1, 1, 255, 4, 1, 65, 0, 0))
开发者ID:catapult-project,项目名称:catapult,代码行数:19,代码来源:test_encoder.py


示例7: testWithTaggedChoice

    def testWithTaggedChoice(self):

        c = univ.Choice(
            componentType=namedtype.NamedTypes(
                namedtype.NamedType('premium', univ.Boolean())
            )
        ).subtype(implicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatConstructed, 7))

        s = univ.Set(
            componentType=namedtype.NamedTypes(
                namedtype.NamedType('name', univ.OctetString()),
                namedtype.NamedType('customer', c)
            )
        )

        s.setComponentByName('name', 'A')
        s.getComponentByName('customer').setComponentByName('premium', True)

        assert encoder.encode(s) == ints2octs((49, 128, 4, 1, 65, 167, 128, 1, 1, 255, 0, 0, 0, 0))
开发者ID:catapult-project,项目名称:catapult,代码行数:19,代码来源:test_encoder.py


示例8: testTrue

 def testTrue(self):
     assert encoder.encode(univ.Boolean(1)) == ints2octs((1, 1, 255))
开发者ID:dmbaggett,项目名称:pyasn1,代码行数:2,代码来源:encoder.py


示例9: testEmpty

 def testEmpty(self):
     self.s.clear()
     assert encoder.encode(self.s) == ints2octs((49, 128, 0, 0))
开发者ID:luke-chang,项目名称:gecko-1,代码行数:3,代码来源:test_encoder.py


示例10: testIndefMode4

    def testIndefMode4(self):
        self.s.clear()
        self.s.append('a')
        self.s.append('b')

        assert encoder.encode(self.s) == ints2octs((49, 128, 4, 1, 97, 4, 1, 98, 0, 0))
开发者ID:luke-chang,项目名称:gecko-1,代码行数:6,代码来源:test_encoder.py


示例11: testWithDefaultedIndefMode

 def testWithDefaultedIndefMode(self):
     assert encoder.encode(
         self.s
     ) == ints2octs((48, 128, 5, 0, 4, 11, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110, 2, 1, 1, 0, 0))
开发者ID:luke-chang,项目名称:gecko-1,代码行数:4,代码来源:test_encoder.py


示例12: testIndefMode

 def testIndefMode(self):
     self.__init()
     assert encoder.encode(self.s) == ints2octs((49, 128, 5, 0, 0, 0))
开发者ID:dmbaggett,项目名称:pyasn1,代码行数:3,代码来源:encoder.py


示例13: testShortMode

 def testShortMode(self):
     assert encoder.encode(
         univ.OctetString('Quick brown fox')
         ) == ints2octs((4, 15, 81, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110, 32, 102, 111, 120))
开发者ID:dmbaggett,项目名称:pyasn1,代码行数:4,代码来源:encoder.py


示例14: testWithOptionalAndDefaultedIndefMode

 def testWithOptionalAndDefaultedIndefMode(self):
     self.__initWithOptionalAndDefaulted()
     assert encoder.encode(
         self.s
         ) == ints2octs((49, 128, 2, 1, 1, 4, 11, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110, 5, 0, 0, 0))
开发者ID:dmbaggett,项目名称:pyasn1,代码行数:5,代码来源:encoder.py


示例15: testOptional

 def testOptional(self):
     s = self.__initOptional()
     assert encoder.encode(s) == ints2octs((48, 128, 0, 0))
开发者ID:luke-chang,项目名称:gecko-1,代码行数:3,代码来源:test_encoder.py


示例16: testOptionalWithValue

 def testOptionalWithValue(self):
     s = self.__initOptionalWithValue()
     assert encoder.encode(s) == ints2octs((48, 128, 48, 128, 4, 4, 116, 101, 115, 116, 0, 0, 0, 0))
开发者ID:luke-chang,项目名称:gecko-1,代码行数:3,代码来源:test_encoder.py


示例17: testOptionalWithDefault

 def testOptionalWithDefault(self):
     s = self.__initOptionalWithDefault()
     assert encoder.encode(s) == ints2octs((48, 128, 48, 128, 2, 1, 123, 0, 0, 0, 0))
开发者ID:luke-chang,项目名称:gecko-1,代码行数:3,代码来源:test_encoder.py


示例18: testOptionalWithDefaultAndOptional

 def testOptionalWithDefaultAndOptional(self):
     s = self.__initOptionalWithDefaultAndOptional()
     assert encoder.encode(s) == ints2octs((48, 128, 48, 128, 4, 4, 116, 101, 115, 116, 2, 1, 123, 0, 0, 0, 0))
开发者ID:luke-chang,项目名称:gecko-1,代码行数:3,代码来源:test_encoder.py


示例19: testDefaultWithDefault

 def testDefaultWithDefault(self):
     s = self.__initDefaultWithDefault()
     assert encoder.encode(s) == ints2octs((48, 128, 48, 128, 4, 4, 116, 101, 115, 116, 0, 0, 0, 0))
开发者ID:luke-chang,项目名称:gecko-1,代码行数:3,代码来源:test_encoder.py


示例20: testWithOptionalIndefMode

 def testWithOptionalIndefMode(self):
     self.__initWithOptional()
     assert encoder.encode(
         self.s
     ) == ints2octs((48, 128, 5, 0, 4, 11, 113, 117, 105, 99, 107, 32, 98, 114, 111, 119, 110, 0, 0))
开发者ID:luke-chang,项目名称:gecko-1,代码行数:5,代码来源:test_encoder.py



注:本文中的pyasn1.codec.cer.encoder.encode函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python decoder.decode函数代码示例发布时间:2022-05-25
下一篇:
Python encoder.encode函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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