Coverage for tests / test_mem.py: 50%
22 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-26 08:44 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-26 08:44 +0000
1# This file is part of lsst-resources.
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# Use of this source code is governed by a 3-clause BSD-style
10# license that can be found in the LICENSE file.
12import unittest
14from lsst.resources import ResourcePath
15from lsst.resources.tests import GenericTestCase
18class MemoryTestCase(GenericTestCase, unittest.TestCase):
19 """Generic tests of the mem URI."""
21 scheme = "mem"
22 netloc = "unknown"
25class MemoryReadTestCase(unittest.TestCase):
26 """Simple tests of I/O with mem URI."""
28 def setUp(self):
29 self.root_uri = ResourcePath("mem://x/y.z")
31 def test_exists(self):
32 """Always exist."""
33 self.assertTrue(self.root_uri.exists())
35 def test_local(self):
36 with self.assertRaises(RuntimeError):
37 with self.root_uri.as_local():
38 pass
40 def test_get_info(self) -> None:
41 info = self.root_uri.get_info()
42 self.assertTrue(info.is_file)
43 self.assertEqual(info.uri, str(self.root_uri))
44 self.assertEqual(info.size, 0)
45 self.assertEqual(info.checksums, {})
46 self.assertIsNone(info.last_modified)
49if __name__ == "__main__":
50 unittest.main()