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 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(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_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_lex_ebnf(patch, bundle): """ Ensures Bundle.lex supports specifying an ebnf file """ patch.object(Story, 'from_file') patch.object(Bundle, 'find_stories', return_value=['story']) patch.object(Bundle, 'parser') bundle.lex(ebnf='ebnf') Bundle.parser.assert_called_with('ebnf') Story.from_file().lex.assert_called_with(parser=Bundle.parser())
def test_bundle_lex_ebnf(patch, bundle): """ Ensures Bundle.lex supports specifying an ebnf file """ patch.object(Story, "from_file") patch.object(Bundle, "find_stories", return_value=["story"]) patch.object(Bundle, "parser") bundle.lex(ebnf="ebnf") Bundle.parser.assert_called_with("ebnf") Story.from_file().lex.assert_called_with(parser=Bundle.parser())
def test_bundle_lex(patch, bundle): """ Ensures Bundle.lex can lex a bundle """ patch.object(Story, 'from_file') patch.object(Bundle, 'find_stories', return_value=['story']) patch.object(Bundle, 'parser') result = bundle.lex() Story.from_file.assert_called_with('story', features=bundle.features) Bundle.parser.assert_called_with(None) Story.from_file().lex.assert_called_with(parser=Bundle.parser()) assert result['story'] == Story.from_file().lex()
def test_bundle_lex(patch, bundle): """ Ensures Bundle.lex can lex a bundle """ patch.object(Story, "from_file") patch.object(Bundle, "find_stories", return_value=["story"]) patch.object(Bundle, "parser") result = bundle.lex() Story.from_file.assert_called_with("story", features=bundle.features) Bundle.parser.assert_called_with(None) Story.from_file().lex.assert_called_with(parser=Bundle.parser()) assert result["story"] == Story.from_file().lex()
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_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())