示例#1
0
def test_app_lexer(patch, read_story):
    patch.init(Parser)
    patch.object(Parser, 'lex')
    patch.object(App, 'get_stories', return_value=['one.story'])
    result = App.lex('/path')
    App.read_story.assert_called_with('one.story')
    Parser.lex.assert_called_with(App.read_story())
    assert result == {'one.story': Parser.lex()}
示例#2
0
def test_story_lex(patch, story, parser):
    result = story.lex(parser=parser)
    parser.lex.assert_called_with(story.story)
    assert result == Parser.lex()
示例#3
0
def test_story_lex(patch, story):
    patch.init(Parser)
    patch.object(Parser, 'lex')
    assert story.lex() == Parser.lex()
示例#4
0
def test_story_lex(patch, story, parser):
    result = story.lex()
    Parser.__init__.assert_called_with(ebnf=None)
    Parser.lex.assert_called_with(story.story)
    assert result == Parser.lex()