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


Python TestUtils.get_album_ids_titles方法代码示例

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


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

示例1: test_long_album

# 需要导入模块: from tests.testutils import TestUtils [as 别名]
# 或者: from tests.testutils.TestUtils import get_album_ids_titles [as 别名]
    def test_long_album(self):
        tu = TestUtils()
        assert tu.is_env_clean(tu.conf['lycheepath']), "env not clean"
        # get max_width column album name width
        maxwidth = tu.get_column_width("lychee_albums", "title")
        logger.info("album title length: " + str(maxwidth))
        # create long album name
        dest_alb_name = 'a' * (maxwidth + 10)
        assert len(dest_alb_name) == (maxwidth + 10)

        # copy album with name
        tu.load_photoset("album1", dest_alb_name)

        # launch lycheesync
        src = tu.conf['testphotopath']
        lych = tu.conf['lycheepath']
        conf = tu.conf['conf']

        # run
        runner = CliRunner()
        result = runner.invoke(main, [src, lych, conf, '-v'])
        # no crash
        assert result.exit_code == 0, "process result is ok"

        # there is a max_width album
        albums = tu.get_album_ids_titles()
        alb_real_name = albums.pop()["title"]
        assert len(alb_real_name) == maxwidth, "album len is not " + str(maxwidth)
开发者ID:gandelman-a,项目名称:lycheesync,代码行数:30,代码来源:test_main.py

示例2: test_dash_wo_s

# 需要导入模块: from tests.testutils import TestUtils [as 别名]
# 或者: from tests.testutils.TestUtils import get_album_ids_titles [as 别名]
    def test_dash_wo_s(self):
        # -s => no album reorder
        tu = TestUtils()
        assert tu.is_env_clean(tu.conf['lycheepath']), "env not clean"
        # load a bunch of album
        tu.load_photoset("aaa")
        tu.load_photoset("mini")
        tu.load_photoset("zzzz")
        tu.load_photoset("album1")
        tu.load_photoset("album3")
        # launch lycheesync
        src = tu.conf['testphotopath']
        lych = tu.conf['lycheepath']
        conf = tu.conf['conf']

        # run
        runner = CliRunner()
        result = runner.invoke(main, [src, lych, conf, '-v'])
        # no crash
        assert result.exit_code == 0, "process result is ok"

        # get a_id, a_names
        list = tu.get_album_ids_titles()
        logger.info(list)
        # album name sorted

        # id sorted
        ids = sorted([x['id'] for x in list])
        titles = sorted([x['title'] for x in list])

        logger.info(ids)
        logger.info(titles)

        # combine
        ordered_list = zip(ids, titles)
        logger.info(ordered_list)
        # for each sorted
        well_sorted = True
        for x in ordered_list:
            logger.info(x)

            if (tu.get_album_id(x[1]) != x[0]):
                well_sorted = False

        assert (not well_sorted), "elements should not be sorted"
开发者ID:gandelman-a,项目名称:lycheesync,代码行数:47,代码来源:test_main.py


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