Coverage for tests/test_quantum.py: 30%
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 daf_butler.
2#
3# Developed for the LSST Data Management System.
4# This product includes software developed by the LSST Project
5# (http://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 <http://www.gnu.org/licenses/>.
22import unittest
24from lsst.daf.butler import Quantum, DimensionUniverse, NamedKeyDict, StorageClass, DatasetType, DatasetRef
26"""Tests for Quantum.
27"""
30class QuantumTestCase(unittest.TestCase):
31 """Test for Quantum.
32 """
34 def testConstructor(self):
35 """Test of constructor.
36 """
37 # Quantum specific arguments
38 taskName = "some.task.object" # can't use a real PipelineTask due to inverted package dependency
40 quantum = Quantum(taskName=taskName)
41 self.assertEqual(quantum.taskName, taskName)
42 self.assertEqual(quantum.initInputs, {})
43 self.assertEqual(quantum.inputs, NamedKeyDict())
44 self.assertEqual(quantum.outputs, {})
45 self.assertIsNone(quantum.dataId)
47 universe = DimensionUniverse()
48 instrument = "DummyCam"
49 datasetTypeName = "test_ds"
50 storageClass = StorageClass("testref_StructuredData")
51 datasetType = DatasetType(datasetTypeName, universe.extract(("instrument", "visit")), storageClass)
52 predictedInputs = {datasetType: [DatasetRef(datasetType, dict(instrument=instrument, visit=42)),
53 DatasetRef(datasetType, dict(instrument=instrument, visit=43))]}
54 outputs = {datasetType: [DatasetRef(datasetType, dict(instrument=instrument, visit=42)),
55 DatasetRef(datasetType, dict(instrument=instrument, visit=43))]}
57 quantum = Quantum(taskName=taskName, inputs=predictedInputs, outputs=outputs)
58 self.assertEqual(len(quantum.inputs[datasetType]), 2)
59 self.assertEqual(len(quantum.outputs[datasetType]), 2)
62if __name__ == "__main__": 62 ↛ 63line 62 didn't jump to line 63, because the condition on line 62 was never true
63 unittest.main()