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


Python Blok.query方法代码示例

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


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

示例1: test_replace_blok_by_another_in_one_step

# 需要导入模块: from anyblok.blok import Blok [as 别名]
# 或者: from anyblok.blok.Blok import query [as 别名]
 def test_replace_blok_by_another_in_one_step(self):
     registry = self.init_registry(None)
     Blok = registry.System.Blok
     testblok1 = Blok.query().filter(Blok.name == 'test-blok1').first()
     testblok13 = Blok.query().filter(Blok.name == 'test-blok13').first()
     registry.upgrade(install=('test-blok1',))
     self.assertEqual(testblok1.state, 'installed')
     self.assertEqual(testblok13.state, 'uninstalled')
     registry.upgrade(uninstall=('test-blok1',), install=('test-blok13',))
     self.assertEqual(testblok1.state, 'uninstalled')
     self.assertEqual(testblok13.state, 'installed')
开发者ID:petrus-v,项目名称:AnyBlok,代码行数:13,代码来源:test_blok.py

示例2: test_install

# 需要导入模块: from anyblok.blok import Blok [as 别名]
# 或者: from anyblok.blok.Blok import query [as 别名]
 def test_install(self):
     registry = self.init_registry(None)
     Blok = registry.System.Blok
     registry.upgrade(install=('test-blok6',))
     testblok1 = Blok.query().filter(Blok.name == 'test-blok1').first()
     testblok6 = Blok.query().filter(Blok.name == 'test-blok6').first()
     self.assertEqual(testblok1.state, 'installed')
     self.assertEqual(testblok1.version, '1.0.0')
     self.assertEqual(testblok1.installed_version, '1.0.0')
     self.assertEqual(testblok6.state, 'installed')
     self.assertEqual(testblok6.version, '1.0.0')
     self.assertEqual(testblok6.installed_version, '1.0.0')
开发者ID:petrus-v,项目名称:AnyBlok,代码行数:14,代码来源:test_blok.py

示例3: test_update_required

# 需要导入模块: from anyblok.blok import Blok [as 别名]
# 或者: from anyblok.blok.Blok import query [as 别名]
 def test_update_required(self):
     registry = self.init_registry(None)
     registry.upgrade(install=('test-blok2',))
     Blok = registry.System.Blok
     testblok1 = Blok.query().filter(Blok.name == 'test-blok1').first()
     testblok2 = Blok.query().filter(Blok.name == 'test-blok2').first()
     testblok1.version = '2.0.0'
     testblok2.version = '2.0.0'
     registry.upgrade(update=('test-blok1',))
     self.assertEqual(testblok1.state, 'installed')
     self.assertEqual(testblok1.installed_version, '2.0.0')
     self.assertEqual(testblok2.state, 'installed')
     self.assertEqual(testblok2.installed_version, '2.0.0')
开发者ID:petrus-v,项目名称:AnyBlok,代码行数:15,代码来源:test_blok.py

示例4: test_uninstall

# 需要导入模块: from anyblok.blok import Blok [as 别名]
# 或者: from anyblok.blok.Blok import query [as 别名]
 def test_uninstall(self):
     registry = self.init_registry(None)
     registry.upgrade(install=('test-blok2',))
     registry.upgrade(uninstall=('test-blok2',))
     Blok = registry.System.Blok
     testblok1 = Blok.query().filter(Blok.name == 'test-blok1').first()
     testblok2 = Blok.query().filter(Blok.name == 'test-blok2').first()
     self.assertEqual(testblok1.state, 'installed')
     self.assertEqual(testblok1.version, '1.0.0')
     self.assertEqual(testblok1.installed_version, '1.0.0')
     self.assertEqual(testblok2.state, 'uninstalled')
     self.assertEqual(testblok2.version, '1.0.0')
     self.assertIsNone(testblok2.installed_version)
开发者ID:jssuzanne,项目名称:AnyBlok,代码行数:15,代码来源:test_blok.py

示例5: test_update_conditionnal

# 需要导入模块: from anyblok.blok import Blok [as 别名]
# 或者: from anyblok.blok.Blok import query [as 别名]
 def test_update_conditionnal(self):
     registry = self.init_registry(None)
     registry.upgrade(install=('test-blok5',))
     Blok = registry.System.Blok
     testblok1 = Blok.query().filter(Blok.name == 'test-blok1').first()
     testblok4 = Blok.query().filter(Blok.name == 'test-blok4').first()
     testblok5 = Blok.query().filter(Blok.name == 'test-blok5').first()
     testblok1.version = '2.0.0'
     testblok4.version = '2.0.0'
     testblok5.version = '2.0.0'
     registry.upgrade(update=('test-blok1',))
     self.assertEqual(testblok1.state, 'installed')
     self.assertEqual(testblok1.installed_version, '2.0.0')
     self.assertEqual(testblok4.state, 'installed')
     self.assertEqual(testblok4.installed_version, '1.0.0')
     self.assertEqual(testblok5.state, 'installed')
     self.assertEqual(testblok5.installed_version, '2.0.0')
开发者ID:petrus-v,项目名称:AnyBlok,代码行数:19,代码来源:test_blok.py

示例6: test_blok_exist

# 需要导入模块: from anyblok.blok import Blok [as 别名]
# 或者: from anyblok.blok.Blok import query [as 别名]
    def test_blok_exist(self):
        registry = self.init_registry(None)
        Blok = registry.System.Blok
        query = Blok.query().filter(Blok.name == 'test-blok2')
        if not query.count():
            self.fail('No blok found')

        testblok2 = query.first()
        self.assertEqual(testblok2.state, 'uninstalled')
        self.assertEqual(testblok2.version, '1.0.0')
        self.assertEqual(testblok2.installed_version, None)
        self.assertEqual(testblok2.short_description, 'Test blok2')
开发者ID:petrus-v,项目名称:AnyBlok,代码行数:14,代码来源:test_blok.py

示例7: test_install_1by1

# 需要导入模块: from anyblok.blok import Blok [as 别名]
# 或者: from anyblok.blok.Blok import query [as 别名]
 def test_install_1by1(self):
     registry = self.init_registry(None)
     registry.upgrade(install=('test-blok1',))
     Blok = registry.System.Blok
     testblok1 = Blok.query().filter(Blok.name == 'test-blok1').first()
     testblok4 = Blok.query().filter(Blok.name == 'test-blok4').first()
     testblok5 = Blok.query().filter(Blok.name == 'test-blok5').first()
     self.assertEqual(testblok1.state, 'installed')
     self.assertEqual(testblok1.version, '1.0.0')
     self.assertEqual(testblok1.installed_version, '1.0.0')
     self.assertEqual(testblok4.state, 'uninstalled')
     self.assertEqual(testblok4.version, '1.0.0')
     self.assertEqual(testblok4.installed_version, None)
     self.assertEqual(testblok5.state, 'uninstalled')
     self.assertEqual(testblok5.version, '1.0.0')
     self.assertEqual(testblok5.installed_version, None)
     registry.upgrade(install=('test-blok4',))
     testblok1 = Blok.query().filter(Blok.name == 'test-blok1').first()
     testblok4 = Blok.query().filter(Blok.name == 'test-blok4').first()
     testblok5 = Blok.query().filter(Blok.name == 'test-blok5').first()
     self.assertEqual(testblok1.state, 'installed')
     self.assertEqual(testblok1.version, '1.0.0')
     self.assertEqual(testblok1.installed_version, '1.0.0')
     self.assertEqual(testblok4.state, 'installed')
     self.assertEqual(testblok4.version, '1.0.0')
     self.assertEqual(testblok4.installed_version, '1.0.0')
     self.assertEqual(testblok5.state, 'installed')
     self.assertEqual(testblok5.version, '1.0.0')
     self.assertEqual(testblok5.installed_version, '1.0.0')
开发者ID:petrus-v,项目名称:AnyBlok,代码行数:31,代码来源:test_blok.py


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