Exemplo n.º 1
0
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
Exemplo n.º 2
0
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
Exemplo n.º 3
0
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)
Exemplo n.º 4
0
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)
Exemplo n.º 5
0
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
Exemplo n.º 6
0
 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)
Exemplo n.º 7
0
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)
Exemplo n.º 8
0
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)
Exemplo n.º 9
0
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())
Exemplo n.º 10
0
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())