예제 #1
0
def test_app_parse_ebnf(bundle):
    """
    Ensures App.parse supports specifying an ebnf
    """
    App.parse('path', ebnf='ebnf')
    bt = Bundle.from_path().bundle_trees
    bt.assert_called_with(ebnf='ebnf', lower=False)
예제 #2
0
파일: App.py 프로젝트: nemani/storyscript
def test_app_parse(bundle):
    """
    Ensures App.parse returns the parsed bundle
    """
    result = App.parse('path')
    Bundle.from_path.assert_called_with('path', ignored_path=None)
    Bundle.from_path().bundle_trees.assert_called_with(ebnf=None)
    assert result == Bundle.from_path().bundle_trees()
예제 #3
0
def test_app_parse_lower(patch, bundle, magic):
    """
    Ensures App.parse applies the loweror
    """
    story = magic()
    Bundle.from_path().bundle_trees.return_value = {'foo.story': story}
    result = App.parse('path', lower=True)
    Bundle.from_path.assert_called_with('path', ignored_path=None)
    bt = Bundle.from_path().bundle_trees
    bt.assert_called_with(ebnf=None, lower=True)
    assert result == Bundle.from_path().bundle_trees(story)
예제 #4
0
def test_app_parse_preprocess(patch, bundle, magic):
    """
    Ensures App.parse applies the preprocessor
    """
    patch.object(Preprocessor, 'process')
    story = magic()
    Bundle.from_path().bundle_trees.return_value = {'foo.story': story}
    result = App.parse('path', preprocess=True)
    assert Preprocessor.process.call_count == 1
    Bundle.from_path.assert_called_with('path', ignored_path=None)
    Bundle.from_path().bundle_trees.assert_called_with(ebnf=None)
    assert result == {'foo.story': Preprocessor.process(story)}
예제 #5
0
파일: App.py 프로젝트: nemani/storyscript
def test_app_parse_ignored_path(bundle):
    App.parse('path', ignored_path='ignored')
    Bundle.from_path.assert_called_with('path', ignored_path='ignored')