Coverage for tests/test_fsScanner.py: 52%
23 statements
« prev ^ index » next coverage.py v6.5.0, created at 2022-11-11 02:39 -0800
« prev ^ index » next coverage.py v6.5.0, created at 2022-11-11 02:39 -0800
1#
2# LSST Data Management System
3# Copyright 2015 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#
23import unittest
24import os
25import lsst.utils.tests
26from lsst.daf.persistence import FsScanner
28# Define the root of the tests relative to this file
29ROOT = os.path.abspath(os.path.dirname(__file__))
32class FsScannerTestCase(unittest.TestCase):
34 def test1(self):
35 template = '%(visit)d%(state)1s.fits.fz[%(extension)d]'
36 scanner = FsScanner(template)
37 res = scanner.processPath(os.path.join(ROOT, 'testFsScanner'))
38 self.assertEqual(res, {'1038843o.fits.fz': {'state': 'o', 'visit': 1038843}})
40 def test2(self):
41 template = 'raw_v%(visit)d_f%(filter)1s.fits.gz'
42 scanner = FsScanner(template)
43 res = scanner.processPath(os.path.join(ROOT, 'testFsScanner'))
44 self.assertEqual(res, {'raw_v1_fg.fits.gz': {'visit': 1, 'filter': 'g'}})
47class TestMemory(lsst.utils.tests.MemoryTestCase):
48 pass
51def setup_module(module):
52 lsst.utils.tests.init()
55if __name__ == "__main__": 55 ↛ 56line 55 didn't jump to line 56, because the condition on line 55 was never true
56 lsst.utils.tests.init()
57 unittest.main()