Beispiel #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)
Beispiel #2
0
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()
Beispiel #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)
Beispiel #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)}
Beispiel #5
0
def test_app_parse_ignored_path(bundle):
    App.parse('path', ignored_path='ignored')
    Bundle.from_path.assert_called_with('path', ignored_path='ignored')