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


Python ExampleDatabase.storage方法代码示例

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


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

示例1: test_storage_does_not_error_if_the_database_is_invalid

# 需要导入模块: from hypothesis.database import ExampleDatabase [as 别名]
# 或者: from hypothesis.database.ExampleDatabase import storage [as 别名]
def test_storage_does_not_error_if_the_database_is_invalid():
    database = ExampleDatabase()
    strat = integers()
    key = u'wtf'
    ints = database.storage(key)
    database.backend.save(key, u'["hi", "there"]')
    assert list(ints.fetch(strat)) == []
开发者ID:jwg4,项目名称:hypothesis,代码行数:9,代码来源:test_database.py

示例2: test_can_round_trip_through_the_database

# 需要导入模块: from hypothesis.database import ExampleDatabase [as 别名]
# 或者: from hypothesis.database.ExampleDatabase import storage [as 别名]
 def test_can_round_trip_through_the_database(self, template, rnd):
     empty_db = ExampleDatabase(backend=SQLiteBackend(":memory:"))
     try:
         storage = empty_db.storage("round trip")
         storage.save(template, strat)
         values = list(storage.fetch(strat))
         assert len(values) == 1
         assert strat.to_basic(template) == strat.to_basic(values[0])
     finally:
         empty_db.close()
开发者ID:AndreaCrotti,项目名称:hypothesis,代码行数:12,代码来源:strategytests.py

示例3: via_database

# 需要导入模块: from hypothesis.database import ExampleDatabase [as 别名]
# 或者: from hypothesis.database.ExampleDatabase import storage [as 别名]
def via_database(spec, strat, template):
    db = ExampleDatabase()
    key = u'via_database'
    try:
        s = db.storage(key)
        s.save(template, strat)
        results = list(s.fetch(strat))
        assert len(results) == 1
        return results[0]
    finally:
        db.close()
开发者ID:kevinleestone,项目名称:hypothesis,代码行数:13,代码来源:debug.py

示例4: run_round_trip

# 需要导入模块: from hypothesis.database import ExampleDatabase [as 别名]
# 或者: from hypothesis.database.ExampleDatabase import storage [as 别名]
def run_round_trip(specifier, value, format=None, backend=None):
    if backend is not None:
        backend = backend()
    else:
        backend = SQLiteBackend()
    db = ExampleDatabase(format=format, backend=backend)
    try:
        storage = db.storage(u'round trip')
        storage.save(value, specifier)
        saved = list(storage.fetch(specifier))
        assert len(saved) == 1
        assert specifier.to_basic(saved[0]) == specifier.to_basic(value)
    finally:
        db.close()
开发者ID:GMadorell,项目名称:hypothesis,代码行数:16,代码来源:test_database.py

示例5: test_can_save_all_strings

# 需要导入模块: from hypothesis.database import ExampleDatabase [as 别名]
# 或者: from hypothesis.database.ExampleDatabase import storage [as 别名]
def test_can_save_all_strings(s):
    db = ExampleDatabase()
    storage = db.storage(u'text')
    storage.save(tuple(s), text())
开发者ID:jwg4,项目名称:hypothesis,代码行数:6,代码来源:test_database.py


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