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


Python MultiFieldSelector.from_path方法代码示例

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


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

示例1: test_mfs_marshal

# 需要导入模块: from normalize.selector import MultiFieldSelector [as 别名]
# 或者: from normalize.selector.MultiFieldSelector import from_path [as 别名]
    def test_mfs_marshal(self):
        mfs = MultiFieldSelector(
            ["rakkk", None, "awkkkkkk"],
            ["rakkk", None, "zgruppp"],
            ["cr_r_a_a_ck", "rip"],
            ["cr_r_a_a_ck", "aiieee"],
        )

        path = mfs.path

        new_mfs = MultiFieldSelector.from_path(path)
        for fs in mfs:
            self.assertIn(fs, new_mfs)
            parts = list(fs)
            self.assertIsNotNone(parts[-1])

        for fs in new_mfs:
            self.assertIn(fs, mfs)

        self.assertEqual(len(mfs.path), len(new_mfs.path))

        for path in (".foo", ".foo[*]", ".foo.bar[*]"):
            mfs = MultiFieldSelector.from_path(path)
            self.assertEqual(mfs.path, path)

        for mfs_fs in (
            ((),),
            (("foo",),),
            ((1,), (2,)),
            ((None,)),
            (("foo", "bar", None),),
        ):
            mfs = MultiFieldSelector(*mfs_fs)
            path = mfs.path
            mfs_loop = MultiFieldSelector.from_path(path)
            self.assertEqual(mfs_loop.path, path)
            self.assertEqual(list(fs.path for fs in mfs),
                             list(fs.path for fs in mfs_loop))
开发者ID:hearsaycorp,项目名称:normalize,代码行数:40,代码来源:test_selector.py

示例2: test_mfs_marshal

# 需要导入模块: from normalize.selector import MultiFieldSelector [as 别名]
# 或者: from normalize.selector.MultiFieldSelector import from_path [as 别名]
    def test_mfs_marshal(self):
        mfs = MultiFieldSelector(
            ["rakkk", None, "awkkkkkk"],
            ["rakkk", None, "zgruppp"],
            ["cr_r_a_a_ck", "rip"],
            ["cr_r_a_a_ck", "aiieee"],
        )

        path = mfs.path

        new_mfs = MultiFieldSelector.from_path(path)
        for fs in mfs:
            self.assertIn(fs, new_mfs)

        for fs in new_mfs:
            self.assertIn(fs, mfs)

        self.assertEqual(len(mfs.path), len(new_mfs.path))
开发者ID:rafaelrruiz,项目名称:normalize,代码行数:20,代码来源:test_selector.py


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