Coverage for tests/test_dir.py: 46%
24 statements
« prev ^ index » next coverage.py v6.5.0, created at 2023-02-11 02:44 -0800
« prev ^ index » next coverage.py v6.5.0, created at 2023-02-11 02:44 -0800
1#
2# LSST Data Management System
3# Copyright 2017 LSST Corporation.
4#
5# This product includes software developed by the
6# LSST Project (http://www.lsst.org/).
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the LSST License Statement and
19# the GNU General Public License along with this program. If not,
20# see <http://www.lsstcorp.org/LegalNotices/>.
21#
23'''
24Test for the custom __dir__ added to tables/baseContinued.py
25'''
26import unittest
27import lsst.utils.tests
29import lsst.geom
30import lsst.afw.table
33class DirTestCase(lsst.utils.tests.TestCase):
34 def testDir(self):
35 '''Ensure the custom __dir__ returns all the expected values'''
36 # Create a source catalog with a minimal schema
37 schema = lsst.afw.table.SourceTable.makeMinimalSchema()
38 catalog = lsst.afw.table.SourceCatalog(schema)
39 record = catalog.addNew()
40 record['coord_dec'] = lsst.geom.degrees*(-5.0)
41 record['coord_ra'] = lsst.geom.degrees*(22)
42 record['id'] = 8
43 record['parent'] = 3
44 # Compare catalog attributes with those from various catalog subclasses
45 attrNames = dir(catalog)
46 desiredNames = set(['_columns', '__module__', 'getX', 'getY',
47 'asAstropy', 'getPsfFluxSlot'])
48 self.assertTrue(desiredNames.issubset(attrNames))
51class MemoryTester(lsst.utils.tests.MemoryTestCase):
52 pass
55def setup_module(module):
56 lsst.utils.tests.init()
59if __name__ == '__main__': 59 ↛ 60line 59 didn't jump to line 60, because the condition on line 59 was never true
60 lsst.utils.tests.init()
61 unittest.main()