コード例 #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
コード例 #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
コード例 #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)
コード例 #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)
コード例 #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
コード例 #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)
コード例 #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)
コード例 #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)
コード例 #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())
コード例 #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())