当前位置: 首页>>代码示例>>Python>>正文


Python Snapshot.get_versionless方法代码示例

本文整理汇总了Python中snapshot.Snapshot.get_versionless方法的典型用法代码示例。如果您正苦于以下问题:Python Snapshot.get_versionless方法的具体用法?Python Snapshot.get_versionless怎么用?Python Snapshot.get_versionless使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在snapshot.Snapshot的用法示例。


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

示例1: _test_checkin_type

# 需要导入模块: from snapshot import Snapshot [as 别名]
# 或者: from snapshot.Snapshot import get_versionless [as 别名]
    def _test_checkin_type(my):
        my.assertEquals(my.auto_snapshot.get_version(), 2)
        dir_name = my.auto_snapshot.get_file_name_by_type('main')
        my.assertEquals(dir_name , 'naming_test_folder_naming_base_test_v002')
        
        dir_name = my.auto_snapshot2.get_file_name_by_type('main')

        my.assertEquals(1, my.auto_snapshot2.get_version())
        my.assertEquals(dir_name , '.tactic_test_naming_folder_test_v001')

        dir_name = my.auto_snapshot3.get_file_name_by_type('main')
        # this takes the auto generated name
        my.assertEquals(dir_name , 'naming_test_folder3_naming_base_test_v003')


        # this one would take into account of the new naming entry introduced in _test_get_naming
        # test a blank checkin_type
        dir_path4 = "./naming_test_folder4"
        checkin = FileCheckin(my.person, dir_path4, "main", context='naming_base_test', snapshot_type='directory', checkin_type='', mode='copy')
        checkin.execute()
        my.auto_snapshot4 = checkin.get_snapshot()
        dir_name = my.auto_snapshot4.get_file_name_by_type('main')
        lib_dir = my.auto_snapshot4.get_dir('relative')
        my.assertEquals(dir_name , 'generic_phil_v004')
        my.assertEquals(lib_dir , 'unittest/cut/generic/phil')
        snapshot_xml = my.auto_snapshot4.get_xml_value('snapshot')
        checkin_type = snapshot_xml.get_nodes_attr('/snapshot','checkin_type')
        # un-specified checkin_type with a matching naming will default to "strict"
        my.assertEquals('strict', checkin_type[0])

        # this should pick the auto checkin_type naming convention with the _OO at the end of context
        checkin = FileCheckin(my.person, dir_path4, "main", context='naming_base_test_OO', snapshot_type='directory', checkin_type='', mode='copy')
        checkin.execute()
        my.auto_snapshot4 = checkin.get_snapshot()
        dir_name = my.auto_snapshot4.get_file_name_by_type('main')
        lib_dir = my.auto_snapshot4.get_dir('relative')
        my.assertEquals(dir_name , 'generic_phil_v001')
        my.assertEquals(lib_dir , 'unittest/cut/generic/phil')
        snapshot_xml = my.auto_snapshot4.get_xml_value('snapshot')
        checkin_type = snapshot_xml.get_nodes_attr('/snapshot','checkin_type')
        # un-specified checkin_type with a matching naming will default to "strict"
        my.assertEquals('auto', checkin_type[0])


        dir_path4 = "./naming_test_folder4"
        checkin = FileCheckin(my.person, dir_path4, "main", context='naming_base_test', snapshot_type='directory', checkin_type='auto')
        checkin.execute()
        my.auto_snapshot5 = checkin.get_snapshot()
        snapshot_xml = my.auto_snapshot5.get_xml_value('snapshot')
        checkin_type = snapshot_xml.get_nodes_attr('/snapshot','checkin_type')
        
        dir_name = my.auto_snapshot5.get_file_name_by_type('main')
        lib_dir = my.auto_snapshot5.get_dir('relative')
        my.assertEquals(dir_name , 'generic_phil_v005')
        my.assertEquals(lib_dir , 'unittest/cut/generic/phil')
        my.assertEquals('auto', checkin_type[0])

        versionless = Snapshot.get_versionless(my.auto_snapshot5.get_value('search_type'), my.auto_snapshot5.get_value('search_id'), 'naming_base_test', mode='latest', create=False)

        dir_name = versionless.get_file_name_by_type('main')
        lib_dir = versionless.get_dir('relative')
        my.assertEquals(dir_name , 'generic_phil')
        my.assertEquals(lib_dir , 'unittest/cut/generic/phil')
        path = versionless.get_lib_path_by_type()
开发者ID:0-T-0,项目名称:TACTIC,代码行数:66,代码来源:naming_test.py


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