# Path: zdict/api.py
# def dump(pattern=r'^.*$'):
#     return [r.word for r in Record.select() if re.fullmatch(pattern, r.word)]


from unittest.mock import patch, Mock
from zdict.api import dump



@patch('zdict.api.Record')
def test_dump(Record):
    # Assume our db contains following words
    Record.select.return_value = [
        Mock(word='apple'),
        Mock(word='apply')]

    # init query
    ret = dump()
    assert ret == ['apple', 'apply']


# Path: zdict/api.py
# def dump(pattern=r'^.*$'):
#     return [r.word for r in Record.select() if re.fullmatch(pattern, r.word)]


# Path: zdict/tests/test_api.py
from unittest.mock import patch, Mock
from zdict.api import dump




@patch('zdict.api.Record')
def test_dump(Record):
    # Assume our db contains following words
    Record.select.return_value = [
        Mock(word='apple'),
        Mock(word='apply')]

    # init query
    ret = dump()
    assert ret == ['apple', 'apply']


    ret = dump(pattern='^.*e$')