Exemplo n.º 1
0
def story():
    return Story('story', features=None)
Exemplo n.º 2
0
def test_exceptions_file_not_found(capsys):
    with raises(StoryError) as e:
        Story.from_file('this-file-does-not-exist', Features(None))
    message = e.value.message()
    assert 'File `this-file-does-not-exist` not found at' in message
Exemplo n.º 3
0
def story_format(source):
    return Story(source, features={}).parse(parser=None).format()
Exemplo n.º 4
0
def test_story_read_not_found(patch, capsys):
    patch.object(io, 'open', side_effect=FileNotFoundError)
    patch.object(os, 'path')
    with raises(StoryError) as e:
        Story.read('whatever')
    assert 'E0001: File "whatever" not found at ' in e.value.short_message()
Exemplo n.º 5
0
def run_story(text):
    features = Features(None)
    return Story(text, features).process()
Exemplo n.º 6
0
def test_story_init_path():
    story = Story('story', path='path')
    assert story.path == 'path'
Exemplo n.º 7
0
def story():
    return Story('story')
Exemplo n.º 8
0
def test_story_from_stream(patch, magic):
    patch.init(Story)
    stream = magic()
    result = Story.from_stream(stream, features=None)
    Story.__init__.assert_called_with(stream.read(), None)
    assert isinstance(result, Story)
Exemplo n.º 9
0
def test_story_init_path():
    story = Story('story', features=None, path='path')
    assert story.path == 'path'
Exemplo n.º 10
0
def test_story_from_stream():
    stream = StringIO('x = 0')
    story = Story.from_stream(stream, features=None)
    assert story.story == 'x = 0'