def test_bundle_bundle(patch, bundle): patch.many(Bundle, ['find_stories', 'services', 'compile', 'parser']) result = bundle.bundle() Bundle.parser.assert_called_with(None) Bundle.compile.assert_called_with(Bundle.find_stories(), parser=Bundle.parser()) expected = {'stories': bundle.stories, 'services': Bundle.services(), 'entrypoint': Bundle.find_stories()} assert result == expected
def test_bundle_bundle(patch, bundle): patch.many(Bundle, ["find_stories", "services", "compile", "parser"]) result = bundle.bundle() Bundle.parser.assert_called_with(None) Bundle.compile.assert_called_with(Bundle.find_stories(), parser=Bundle.parser()) expected = ( { "stories": bundle.stories, "services": Bundle.services(), "entrypoint": Bundle.find_stories(), }, bundle.deprecations, ) assert result == expected
def test_bundle_bundle_trees_ebnf(patch, bundle): patch.many(Bundle, ['find_stories', 'parse', 'parser']) bundle.bundle_trees(ebnf='ebnf') Bundle.parser.assert_called_with('ebnf') Bundle.parse.assert_called_with(Bundle.find_stories(), parser=Bundle.parser(), lower=False)
def test_bundle_bundle_trees_ebnf(patch, bundle): patch.many(Bundle, ["find_stories", "parse", "parser"]) bundle.bundle_trees(ebnf="ebnf") Bundle.parser.assert_called_with("ebnf") Bundle.parse.assert_called_with(Bundle.find_stories(), parser=Bundle.parser(), lower=False)
def test_bundle_bundle_trees(patch, bundle): patch.many(Bundle, ['find_stories', 'parse', 'parser']) result = bundle.bundle_trees() Bundle.parser.assert_called_with(None) Bundle.parse.assert_called_with(Bundle.find_stories(), parser=Bundle.parser(), lower=False) assert result == bundle.stories
def parse(): files = request.json['files'] bundle = Bundle(story_files=files) bundle.parse(bundle.find_stories(), ebnf=None) resp = {} for k, v in bundle.stories.items(): resp[k] = lark_tree(v) return jsonify(resp)
def test_bundle_bundle_lower(patch, bundle, magic): patch.many(Bundle, ['find_stories', 'parse', 'parser']) a_story = magic() bundle.stories = {'foo': a_story} bundle.bundle_trees(ebnf='ebnf', lower=True) Bundle.parser.assert_called_with('ebnf') Bundle.parse.assert_called_with(Bundle.find_stories(), parser=Bundle.parser(), lower=True)
def test_bundle_bundle_lower(patch, bundle, magic): patch.many(Bundle, ["find_stories", "parse", "parser"]) a_story = magic() bundle.stories = {"foo": a_story} bundle.bundle_trees(ebnf="ebnf", lower=True) Bundle.parser.assert_called_with("ebnf") Bundle.parse.assert_called_with(Bundle.find_stories(), parser=Bundle.parser(), lower=True)
def test_bundle_bundle_ebnf(patch, bundle): patch.many(Bundle, ['find_stories', 'services', 'compile', 'parser']) bundle.bundle(ebnf='ebnf') Bundle.parser.assert_called_with('ebnf') Bundle.compile.assert_called_with(Bundle.find_stories(), parser=Bundle.parser())
def test_bundle_bundle_ebnf(patch, bundle): patch.many(Bundle, ["find_stories", "services", "compile", "parser"]) bundle.bundle(ebnf="ebnf") Bundle.parser.assert_called_with("ebnf") Bundle.compile.assert_called_with(Bundle.find_stories(), parser=Bundle.parser())