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