File: test_user_api.py

package info (click to toggle)
pybel 0.15.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 16,492 kB
  • sloc: python: 29,392; javascript: 246; makefile: 226; sh: 20
file content (34 lines) | stat: -rw-r--r-- 936 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# -*- coding: utf-8 -*-

"""Test the user API."""

import unittest

import pybel


class TestParse(unittest.TestCase):
    """Test user API."""

    def test_bel_statement(self):
        for bel in [
            "p(hgnc:1234) -> p(hgnc:1235)",
            "p(hgnc:1234) hasVariant p(hgnc:1234, pmod(Ph))",
            "p(hgnc:1) => rxn(reactants(a(chebi:1), a(chebi:2)), products(a(chebi:3), a(chebi:4)))",
            "r(hgnc:1) pos r(hgnc:2)",
            "r(hgnc:1) cor r(hgnc:2)",
            "r(hgnc:1) eq r(ncbigene:5)",
            "p(hgnc:1) -> (p(hgnc:2) -> p(hgnc:3))",
            "p(hgnc:1)",
        ]:
            with self.subTest(bel=bel):
                x = pybel.parse(bel)

    def test_citation(self):
        x = pybel.parse("SET Citation = pmid:1234")

    def test_control(self):
        x = pybel.parse('SET Test = "5"')

    def test_control_multiple(self):
        x = pybel.parse('SET Test = {"1","2","3"}')