File: test_mocks.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 (29 lines) | stat: -rw-r--r-- 901 bytes parent folder | download | duplicates (5)
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
# -*- coding: utf-8 -*-

"""Tests for the mocks for the query builder."""

import unittest

from pybel.examples import egf_graph
from pybel.testing.mock_manager import MockQueryManager


class TestMockManager(unittest.TestCase):
    """Tests for the mock query manager."""

    def test_make(self):
        """Test instantiating the mock query manager."""
        manager = MockQueryManager()
        self.assertEqual(0, manager.count_networks())

    def test_make_with_graph(self):
        """Test counting networks in the mock query manager."""
        manager = MockQueryManager(graphs=[egf_graph])
        self.assertEqual(1, manager.count_networks())

    def test_add_graph(self):
        """Test adding a graph with insert_graph."""
        manager = MockQueryManager()
        graph = egf_graph.copy()
        manager.insert_graph(graph)
        self.assertEqual(1, manager.count_networks())