Coverage for tests/test_graphBuilder.py: 55%
Shortcuts on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# This file is part of pipe_base.
2#
3# Developed for the LSST Data Management System.
4# This product includes software developed by the LSST Project
5# (https://www.lsst.org).
6# See the COPYRIGHT file at the top-level directory of this distribution
7# for details of code ownership.
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <https://www.gnu.org/licenses/>.
22"""Tests of things related to the GraphBuilder class."""
24import logging
25import unittest
27from lsst.pipe.base.tests import simpleQGraph
28import lsst.utils.tests
29from lsst.utils.tests import temporaryDirectory
31_LOG = logging.getLogger(__name__)
34class GraphBuilderTestCase(unittest.TestCase):
36 def testDefault(self):
37 """Simple test to verify makeSimpleQGraph can be used to make a Quantum
38 Graph."""
39 with temporaryDirectory() as root:
40 # makeSimpleQGraph calls GraphBuilder.
41 butler, qgraph = simpleQGraph.makeSimpleQGraph(root=root)
42 # by default makeSimpleQGraph makes a graph with 5 nodes
43 self.assertEqual(len(qgraph), 5)
45 def testAddInstrumentMismatch(self):
46 """Verify that a RuntimeError is raised if the instrument in the user
47 query does not match the instrument in the pipeline."""
48 with temporaryDirectory() as root:
49 pipeline = simpleQGraph.makeSimplePipeline(
50 nQuanta=5,
51 instrument="lsst.pipe.base.tests.simpleQGraph.SimpleInstrument")
52 with self.assertRaises(RuntimeError):
53 simpleQGraph.makeSimpleQGraph(root=root,
54 pipeline=pipeline,
55 userQuery="instrument = 'foo'")
58if __name__ == "__main__": 58 ↛ 59line 58 didn't jump to line 59, because the condition on line 58 was never true
59 lsst.utils.tests.init()
60 unittest.main()