Пример #1
0
def test_register_pickle_importer(is_file):
    obj = object()

    def foo_importer(filepath, **kwargs):
        return obj

    is_file.return_value = True

    with patch.dict(mio.input.extensions.pickle_types, {}, clear=True):
        mio.register_pickle_importer('.foo', foo_importer)
        new_obj = mio.import_pickle('fake.foo')
    assert new_obj is obj
Пример #2
0
def test_register_pickle_importer(is_file):
    obj = object()

    def foo_importer(filepath, **kwargs):
        return obj

    is_file.return_value = True

    with patch.dict(mio.input.extensions.pickle_types, {}, clear=True):
        mio.register_pickle_importer('.foo', foo_importer)
        new_obj = mio.import_pickle('fake.foo')
    assert new_obj is obj