예제 #1
0
def test_build_run_is_on_parse_args(monkeypatch):
    """
    Test build run is called with parsed args from main
    """
    mock_build_run = MockMethod()
    monkeypatch.setattr(build, "run", mock_build_run)
    mock_parsed_args = ["arg1", "arg2"]
    monkeypatch.setattr(parse, "args", lambda: mock_parsed_args)
    entry.main()
    assert mock_build_run.kwargs == {"args": mock_parsed_args}
예제 #2
0
파일: __main__.py 프로젝트: bjubes/jse
import entry
entry.main()
예제 #3
0
            for (_,m) in value_tree.members:
                lst.append(self.as_any(m, ident+1) + ',\n')
            return 'return {\n%s}' % (''.join(lst))
        else:
            lst = []
            for (_,m) in value_tree.members:
                if ident > 0 and m.is_empty():
                    continue
                lst.append(self.as_any(m, ident+1))
            return '{%s}' % (','.join(lst))
    def as_dict(self, value_tree, ident):
        return self.as_table(value_tree, ident)
    def as_int(self, value_tree, ident):
        return str(value_tree.value)
    def as_float(self, value_tree, ident):
        return str(value_tree.value)
    def as_bool(self, value_tree, ident):
        if value_tree.value == False:
            return 'false'
        elif value_tree.value == True:
            return 'true'
    def as_string(self, value_tree, ident):
        return add_quote(value_tree.value)
    def as_nil(self, value_tree, ident):
        return 'nil'
    def as_tuple(self, value_tree, ident):
        return '{%s}'%(value_tree.value)

if __name__ == '__main__':
    sys.exit(entry.main(sys.argv, 'lua', LuaFormatter()))
예제 #4
0
        else:
            lst = []
            for (k, m) in value_tree.members:
                if ident > 0 and m.is_empty():
                    continue
                lst.append('%s:%s' %
                           (self.as_key(k), self.as_any(m, ident + 1)))
            return '{%s}' % (','.join(lst))

    def as_int(self, value_tree, ident):
        return str(value_tree.value)

    def as_float(self, value_tree, ident):
        return str(value_tree.value)

    def as_bool(self, value_tree, ident):
        if value_tree.value == False:
            return 'false'
        elif value_tree.value == True:
            return 'true'

    def as_string(self, value_tree, ident):
        return add_quote(value_tree.value)

    def as_nil(self, value_tree, ident):
        return 'none'


if __name__ == '__main__':
    sys.exit(entry.main(sys.argv, 'json', JsonFormatter()))
예제 #5
0
#coding=utf-8

from entry import main
main()