Пример #1
0
    def __load_collection_json(bioc_json: str, is_file: bool = True):
        """load a json bioc collection .
        It will return a bioc collection object.

        :param bioc_json: a str path to a bioc file or a bioc input json string
        :param is_file: if True bioc_input is a path else it is a string
        :returns:  a bioc collection object
        """
        if is_file:
            with open(bioc_json, 'r') as fp:
                collection = biocjson.load(fp)
            return (collection)
        else:
            collection = biocjson.loads(bioc_json)
            return (collection)
Пример #2
0
def test_loads():
    with open(file, encoding='utf8') as fp:
        s = fp.read()
    collection = biocjson.loads(s)
    assert_everything(collection)
Пример #3
0
def test_dumps():
    with open(file, encoding='utf8') as fp:
        collection = biocjson.load(fp)
    s = biocjson.dumps(collection)
    collection = biocjson.loads(s)
    assert_everything(collection)