17 """Tests for lal.utils.cache
19 See utils_cache_verify.py for more tests of the same module
27 from ligo
import segments
36 """Test suite for `lal.utils.CacheEntry`.
38 CacheEntry = lal_utils.CacheEntry
40 @pytest.mark.parametrize(("args", "segs"), (
43 (
"A",
"TEST", segments.segment(0, 1),
"test.gwf"),
44 {
'A': [segments.segment(0, 1)]},
48 (
"-",
"-", segments.segment(2, 10),
"test.gwf"),
49 {
None: [segments.segment(2, 10)]},
53 (
"H1,L1",
"TEST", segments.segment(5, 10),
"test.gwf"),
55 'H1': [segments.segment(5, 10)],
56 'L1': [segments.segment(5, 10)],
61 """Test that `CacheEntry.segmentlistdict` works.
64 assert a.segmentlistdict == segs
69 from glue.lal
import Cache
as GlueCache
70 except ImportError
as exc:
72 GlueCache.entry_class = lal_utils.CacheEntry
78 gcache = GlueCache.from_urls(files, coltype=LIGOTimeGPS)
80 lcache = lal_utils.lalcache_from_gluecache(gcache)
83 if os.path.isfile(fp):
85 assert lcache.length == len(gcache)
86 assert lcache.list.url == (
87 "file://localhost{}".format(os.path.abspath(files[0]))
91 if __name__ ==
'__main__':
92 args = sys.argv[1:]
or [
"-v",
"-rs",
"--junit-xml=junit-utils-cache.xml"]
93 sys.exit(pytest.main(args=[__file__] + args))
Test suite for lal.utils.CacheEntry.
def test_segmentlistdict(self, args, segs)
Test that CacheEntry.segmentlistdict works.
def test_lalcache_from_gluecache()