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

Python compare.is_equal函数代码示例

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

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



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

示例1: test_aug_onelist_pos

 def test_aug_onelist_pos(self):
     # CREATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     e_1 = ysanity.Runner.OneList.OneAugList.Ldata()
     e_2 = ysanity.Runner.OneList.OneAugList.Ldata()
     e_1.number = 1
     e_1.name = e_1._common_path
     e_2.number = 2
     e_2.name = e_2._common_path
     r_1.one_list.one_aug_list.ldata.extend([e_1, e_2])
     r_1.one_list.one_aug_list.enabled = True
     self.crud.create(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # UPDATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     e_1 = ysanity.Runner.OneList.OneAugList.Ldata()
     e_2 = ysanity.Runner.OneList.OneAugList.Ldata()
     e_1.number = 1
     e_1.name = e_1._common_path.replace(':', '/')
     e_2.number = 2
     e_2.name = e_2._common_path.replace(':', '/')
     r_1.one_list.one_aug_list.ldata.extend([e_1, e_2])
     r_1.one_list.one_aug_list.enabled = True
     self.crud.update(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # DELETE
     r_1 = ysanity.Runner()
     self.crud.delete(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(r_2._has_data(), False)
开发者ID:ReignInChaos,项目名称:ydk-gen,代码行数:32,代码来源:test_sanity_levels.py


示例2: test_onelsit_pos

 def test_onelsit_pos(self):
     # READ
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     e_1, e_2 = ysanity.Runner.OneList.Ldata(), ysanity.Runner.OneList.Ldata()
     e_1.number = 1
     e_1.name = 'runner:onelist:ldata['+str(e_1.number)+']:name'
     e_2.number = 2
     e_2.name = 'runner:onelist:ldata['+str(e_2.number)+']:name'
     r_1.one_list.ldata.extend([e_1, e_2])
     self.crud.create(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # UPDATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     e_1, e_2 = ysanity.Runner.OneList.Ldata(), ysanity.Runner.OneList.Ldata()
     e_1.number = 1
     e_1.name = 'runner:onelist:ldata['+str(e_1.number)+']:name'
     e_2.number = 2
     e_2.name = 'runner:onelist:ldata['+str(e_2.number)+']:name'
     r_1.one_list.ldata.extend([e_1, e_2])
     self.crud.update(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # DELETE
     r_1 = ysanity.Runner()
     self.crud.delete(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_1)
     self.assertEqual(r_2._has_data(), False)
开发者ID:ReignInChaos,项目名称:ydk-gen,代码行数:28,代码来源:test_sanity_levels.py


示例3: test_twolist_pos

 def test_twolist_pos(self):
     # READ
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     e_1, e_2 = ysanity.Runner.TwoList.Ldata(), ysanity.Runner.TwoList.Ldata()
     e_11, e_12 = ysanity.Runner.TwoList.Ldata.Subl1(), ysanity.Runner.TwoList.Ldata.Subl1()
     e_1.number = 21
     e_1.name = 'runner:twolist:ldata['+str(e_1.number)+']:name'
     e_11.number = 211 
     e_11.name = 'runner:twolist:ldata['+str(e_1.number)+']:subl1['+str(e_11.number)+']:name'
     e_12.number = 212
     e_12.name = 'runner:twolist:ldata['+str(e_1.number)+']:subl1['+str(e_12.number)+']:name'
     e_1.subl1.extend([e_11, e_12])
     e_21, e_22 = ysanity.Runner.TwoList.Ldata.Subl1(), ysanity.Runner.TwoList.Ldata.Subl1()
     e_2.number = 22
     e_2.name = 'runner:twolist:ldata['+str(e_2.number)+']:name'
     e_21.number = 221
     e_21.name = 'runner:twolist:ldata['+str(e_2.number)+']:subl1['+str(e_21.number)+']:name'
     e_22.number = 222
     e_22.name = 'runner:twolist:ldata['+str(e_2.number)+']:subl1['+str(e_22.number)+']:name'
     e_2.subl1.extend([e_21, e_22])
     r_1.two_list.ldata.extend([e_1, e_2])
     self.crud.create(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # UPDATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     e_1, e_2 = ysanity.Runner.TwoList.Ldata(), ysanity.Runner.TwoList.Ldata()
     e_11, e_12 = ysanity.Runner.TwoList.Ldata.Subl1(), ysanity.Runner.TwoList.Ldata.Subl1()
     e_1.number = 21
     e_1.name = 'runner/twolist/ldata['+str(e_1.number)+']/name'
     e_11.number = 211
     e_11.name = 'runner/twolist/ldata['+str(e_1.number)+']/subl1['+str(e_11.number)+']/name'
     e_12.number = 212
     e_12.name = 'runner/twolist/ldata['+str(e_1.number)+']/subl1['+str(e_12.number)+']/name'
     e_1.subl1.extend([e_11, e_12])
     e_21, e_22 = ysanity.Runner.TwoList.Ldata.Subl1(), ysanity.Runner.TwoList.Ldata.Subl1()
     e_2.number = 22
     e_2.name = 'runner/twolist/ldata['+str(e_2.number)+']/name'
     e_21.number = 221
     e_21.name = 'runner/twolist/ldata['+str(e_2.number)+']/subl1['+str(e_21.number)+']/name'
     e_22.number = 222
     e_22.name = 'runner/twolist/ldata['+str(e_2.number)+']/subl1['+str(e_22.number)+']/name'
     e_2.subl1.extend([e_21, e_22])
     r_1.two_list.ldata.extend([e_1, e_2])
     self.crud.update(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # DELETE
     r_1 = ysanity.Runner()
     self.crud.delete(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_1)
     self.assertEqual(r_2._has_data(), False)
开发者ID:ReignInChaos,项目名称:ydk-gen,代码行数:52,代码来源:test_sanity_levels.py


示例4: test_read_on_identity_ref

    def test_read_on_identity_ref(self):
        r_1 = ysanity.Runner.Ytypes.BuiltInT()
        r_1.identity_ref_value = ysanity.ChildIdentity_Identity()
        self.crud.create(self.ncc, r_1)
        r_2 = ysanity.Runner.Ytypes.BuiltInT()
        r_2.identity_ref_value = READ()
        r_2 = self.crud.read(self.ncc, r_2)
        self.assertEqual(is_equal(r_1, r_2), True)

        r_2 = ysanity.Runner.Ytypes.BuiltInT()
        r_2.identity_ref_value = ysanity.ChildIdentity_Identity()
        r_2 = self.crud.read(self.ncc, r_2)
        self.assertEqual(is_equal(r_1, r_2), True)
开发者ID:ReignInChaos,项目名称:ydk-gen,代码行数:13,代码来源:test_sanity_filters.py


示例5: test_read_on_leaflist

    def test_read_on_leaflist(self):
        r_1 = ysanity.Runner.Ytypes.BuiltInT()
        r_1.llstring = ['1', '2', '3']
        self.crud.create(self.ncc, r_1)
        r_2 = ysanity.Runner.Ytypes.BuiltInT()
        r_2.llstring = READ()
        r_2 = self.crud.read(self.ncc, r_2)
        self.assertEqual(is_equal(r_1, r_2), True)

        r_2 = ysanity.Runner.Ytypes.BuiltInT()
        # invalid input, user should use READ() 
        # or the same data on device
        r_2.llstring = ['something emaillse']
        r_2 = self.crud.read(self.ncc, r_2)
        self.assertNotEqual(is_equal(r_1, r_2), True)
开发者ID:josearsenio,项目名称:ydk-gen,代码行数:15,代码来源:test_sanity_filters.py


示例6: test_CASE6

 def test_CASE6(self):
     a = ysanity.A()
     a.b.c = a.b.C()
     a = self.crud.read(self.ncc, a)
     _a = ysanity.A()
     _a.b.c = _a.b.C()
     self.assertEqual(is_equal(a, _a), True)
开发者ID:josearsenio,项目名称:ydk-gen,代码行数:7,代码来源:test_sanity_filter_read.py


示例7: test_delete_operation_on_list

    def test_delete_operation_on_list(self):
        # create runner with a container and a list
        runner_create = ysanity.Runner()
        runner_create.one.name = 'one'

        elem1 = ysanity.Runner.OneList.Ldata()
        elem2 = ysanity.Runner.OneList.Ldata()
        elem1.number = 1
        elem2.name = 'foo'
        elem2.number = 1
        elem2.name = 'bar'
        runner_create.one_list.ldata.extend([elem1, elem2])

        self.crud.create(self.ncc, runner_create)

        runner_read_filter = ysanity.Runner()
        runner_read = self.crud.read(self.ncc, runner_read_filter)

        self.crud.delete(self.ncc, runner_read.one_list.ldata)

        runner_read = self.crud.read(self.ncc, runner_read_filter)
        runner_left = runner_create
        del runner_left.one_list.ldata[:]

        self.assertEqual(is_equal(runner_read, runner_left), True)
开发者ID:waffle-iron,项目名称:ydk-gen,代码行数:25,代码来源:test_sanity_delete.py


示例8: test_CASE4

 def test_CASE4(self):
     a = ysanity.A()
     a.b.b1 = "some value"
     a = self.crud.read(self.ncc, a)
     _a = self.getInitEntity()
     _a.lst, _a.a1, _a.a2, _a.a3 = YList(), None, None, None
     self.assertEqual(is_equal(a, _a), True)
开发者ID:josearsenio,项目名称:ydk-gen,代码行数:7,代码来源:test_sanity_filter_read.py


示例9: test_CASE2

 def test_CASE2(self):
     a = ysanity.A()
     a.a1 = "some value"
     a = self.crud.read(self.ncc, a)
     # the whole thing        
     _a = self.getInitEntity()
     self.assertEqual(is_equal(a, _a), True)
开发者ID:josearsenio,项目名称:ydk-gen,代码行数:7,代码来源:test_sanity_filter_read.py


示例10: test_CASE3

 def test_CASE3(self):
     a = ysanity.A()
     a.a1 = READ()
     a = self.crud.read(self.ncc, a)
     _a = ysanity.A()
     _a.a1 = "some value"
     self.assertEqual(is_equal(a, _a), True)
开发者ID:josearsenio,项目名称:ydk-gen,代码行数:7,代码来源:test_sanity_filter_read.py


示例11: test_delete_operation_on_list_slice

    def test_delete_operation_on_list_slice(self):
        runner_create = ysanity.Runner()
        runner_create.one.name = 'one'

        foo = ysanity.Runner.OneList.Ldata()
        bar = ysanity.Runner.OneList.Ldata()
        baz = ysanity.Runner.OneList.Ldata()
        foo.number = 1
        foo.name = 'foo'
        bar.number = 2
        bar.name = 'bar'
        baz.number = 3
        baz.name = 'baz'
        runner_create.one_list.ldata.extend([foo, bar, baz])

        self.crud.create(self.ncc, runner_create)

        runner_read = self.read_from_empty_filter()

        elements_to_delete = runner_read.one_list.ldata[:1]
        self.crud.delete(self.ncc, elements_to_delete)

        # read after a crud delete operation
        runner_read = self.read_from_empty_filter()
        runner_left = runner_create
        # manually delete entire list
        del runner_left.one_list.ldata[:1]

        self.assertEqual(is_equal(runner_read, runner_left), True)
开发者ID:ReignInChaos,项目名称:ydk-gen,代码行数:29,代码来源:test_sanity_delete.py


示例12: test_CASE5

 def test_CASE5(self):
     a = ysanity.A()
     e = a.b.d.e
     e.e1 = "some value e1"
     a = self.crud.read(self.ncc, a)
     _a = ysanity.A()
     _a.b.d.e.e1, _a.b.d.e.e2 = "some value e1", "value of e2"
     self.assertEqual(is_equal(a, _a), True)        
开发者ID:josearsenio,项目名称:ydk-gen,代码行数:8,代码来源:test_sanity_filter_read.py


示例13: test_read_on_ref_class

    def test_read_on_ref_class(self):
        r_1 = ysanity.Runner()
        r_1.one.number, r_1.one.name = 1, 'runner:one:name'
        self.crud.create(self.ncc, r_1)
        r_2 = ysanity.Runner()

        r_2.one = READ()
        r_2 = self.crud.read(self.ncc, r_2)
        self.assertEqual(is_equal(r_1, r_2), True)
开发者ID:josearsenio,项目名称:ydk-gen,代码行数:9,代码来源:test_sanity_filters.py


示例14: test_edit_commit_get

    def test_edit_commit_get(self):
        runner = ysanity.Runner()
        runner.one.number = 1
        runner.one.name = 'runner:one:name'

        get_filter = ysanity.Runner()

        op = self.netconf_service.edit_config(self.ncc, Datastore.candidate, runner)
        self.assertIn('ok', op)

        result = self.netconf_service.get_config(self.ncc, Datastore.candidate, get_filter)
        self.assertEqual(is_equal(runner, result), True)

        op = self.netconf_service.commit(self.ncc)
        self.assertIn('ok', op)

        result = self.netconf_service.get(self.ncc, get_filter)
        self.assertEqual(is_equal(runner, result), True)
开发者ID:ReignInChaos,项目名称:ydk-gen,代码行数:18,代码来源:test_sanity_netconf.py


示例15: test_one_level_pos

 def test_one_level_pos(self):
     # READ
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     r_1.one.number, r_1.one.name = 1, 'runner:one:name'
     self.crud.create(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # UPDATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     r_1.one.number, r_1.one.name = 10, 'runner/one/name'
     self.crud.update(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # DELETE
     r_1 = ysanity.Runner()
     self.crud.delete(self.ncc,r_1)
     r_2 = self.crud.read(self.ncc, r_1)
     self.assertEqual(r_2._has_data(), False)
开发者ID:ReignInChaos,项目名称:ydk-gen,代码行数:18,代码来源:test_sanity_levels.py


示例16: test_two_level_pos

 def test_two_level_pos(self):
     # READ
     r_1 = ysanity.Runner()
     r_1.two.number, r_1.two.name, r_1.two.sub1.number = 2, 'runner:two:name', 21
     self.crud.create(self.ncc, r_1)
     r_2 = ysanity.Runner()
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # UPDATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     r_1.two.number, r_1.two.name, r_1.two.sub1.number = 20, 'runner/two/name', 210
     self.crud.update(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # DELETE
     r_1 = ysanity.Runner()
     self.crud.delete(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_1)
     self.assertEqual(r_2._has_data(), False)
开发者ID:ReignInChaos,项目名称:ydk-gen,代码行数:19,代码来源:test_sanity_levels.py


示例17: test_CASE7

 def test_CASE7(self):
     a = ysanity.A()
     l1, l2 = a.Lst(), a.Lst()
     l1.number, l2.number = 1, 2
     a.lst.extend([l1, l2])
     a = self.crud.read(self.ncc, a)
     _a = ysanity.A()
     l1.value, l2.value = "one", "two"
     _a.lst.extend([l1, l2])
     self.assertEqual(is_equal(a, _a), True)
开发者ID:josearsenio,项目名称:ydk-gen,代码行数:10,代码来源:test_sanity_filter_read.py


示例18: test_read_only_config

    def test_read_only_config(self):
        r_1 = ysanity.Runner()
        r_1.one.number, r_1.one.name = 1, 'runner:one:name'
        self.crud.create(self.ncc, r_1)
        r_2, r_3 = ysanity.Runner(), ysanity.Runner()
        r_2.one.number, r_3.one.number = READ(), READ()

        r_2 = self.crud.read(self.ncc, r_2, only_config=True)
        r_3 = self.crud.read(self.ncc, r_3)
        # ysanity only have config data, ok to compare
        self.assertEqual(is_equal(r_2, r_3), True)
开发者ID:ReignInChaos,项目名称:ydk-gen,代码行数:11,代码来源:test_sanity_filters.py


示例19: test_aug_one_pos

 def test_aug_one_pos(self): 
     # CREATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     r_1.one.one_aug.number = 1
     r_1.one.one_aug.name =r_1.one.one_aug._common_path
     self.crud.create(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)
     # UPDATE
     r_1, r_2 = ysanity.Runner(), ysanity.Runner()
     r_1.one.one_aug.number = 10
     r_1.one.one_aug.name =r_1.one.one_aug._common_path.replace(':', '/')
     self.crud.update(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_2)
     self.assertEqual(is_equal(r_1, r_2), True)        
     # DELETE
     r_1 = ysanity.Runner()
     self.crud.delete(self.ncc, r_1)
     r_2 = self.crud.read(self.ncc, r_1)
     self.assertEqual(r_2._has_data(), False)
开发者ID:ReignInChaos,项目名称:ydk-gen,代码行数:20,代码来源:test_sanity_levels.py


示例20: test_read_on_ref_enum_class

    def test_read_on_ref_enum_class(self):
        from ydk.models.ydktest.ydktest_sanity import YdkEnumTestEnum
        r_1 = ysanity.Runner.Ytypes.BuiltInT()
        r_1.enum_value = YdkEnumTestEnum.LOCAL
        self.crud.create(self.ncc, r_1)

        r_2 = ysanity.Runner.Ytypes.BuiltInT()
        r_2.enum_value = READ()
        r_2 = self.crud.read(self.ncc, r_2)
        self.assertEqual(is_equal(r_1, r_2), True)

        r_2 = ysanity.Runner.Ytypes.BuiltInT()
        r_2.enum_value = YdkEnumTestEnum.LOCAL
        r_2 = self.crud.read(self.ncc, r_2)
        self.assertEqual(is_equal(r_1, r_2), True)

        # no such value, nothing returned
        r_2 = ysanity.Runner.Ytypes.BuiltInT()
        r_2.enum_value = YdkEnumTestEnum.REMOTE
        r_2 = self.crud.read(self.ncc, r_2)
        self.assertNotEqual(is_equal(r_1, r_2), True)
开发者ID:josearsenio,项目名称:ydk-gen,代码行数:21,代码来源:test_sanity_filters.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python compat.u函数代码示例发布时间:2022-05-27
下一篇:
Python utils.urljoin函数代码示例发布时间: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