Ejemplo n.º 1
0
 def make_cache():
     segs = SegmentList()
     cache = Cache()
     for seg in [(0, 1), (1, 2), (4, 5)]:
         d = seg[1] - seg[0]
         f = 'A-B-%d-%d.tmp' % (seg[0], d)
         cache.append(CacheEntry.from_T050017(f))
         segs.append(Segment(*seg))
     return cache, segs
Ejemplo n.º 2
0
 def make_cache():
     segs = SegmentList()
     cache = Cache()
     for seg in [(0, 1), (1, 2), (4, 5)]:
         d = seg[1] - seg[0]
         f = 'A-B-%d-%d.tmp' % (seg[0], d)
         cache.append(CacheEntry.from_T050017(f))
         segs.append(Segment(*seg))
     return cache, segs
Ejemplo n.º 3
0
 def make_cache():
     segs = SegmentList()
     cache = Cache()
     for seg in [(0, 1), (1, 2), (4, 5)]:
         d = seg[1] - seg[0]
         _, f = tempfile.mkstemp(prefix='A-',
                                 suffix='-%d-%d.tmp' % (seg[0], d))
         cache.append(CacheEntry.from_T050017(f))
         segs.append(Segment(*seg))
     return cache, segs
Ejemplo n.º 4
0
 def make_cache():
     segs = SegmentList()
     cache = Cache()
     for seg in [(0, 1), (1, 2), (4, 5)]:
         d = seg[1] - seg[0]
         _, f = tempfile.mkstemp(prefix='A-',
                                 suffix='-%d-%d.tmp' % (seg[0], d))
         cache.append(CacheEntry.from_T050017(f))
         segs.append(Segment(*seg))
     return cache, segs
Ejemplo n.º 5
0
def test_io_identify(cls, extensions, modes=['read', 'write']):
    for mode in modes:
        for ext in extensions:
            p = 'X-TEST_CACHE_ENTRY-0-1.%s' % ext
            c = Cache([CacheEntry.from_T050017(p)])
            for path in [p, [p], c[0], c]:
                formats = identify_format(mode, cls, path, None, [], {})
                if len(formats) == 0:
                    raise RuntimeError(
                        "No %s.%s method identified for "
                        "file-format %r in form %r" %
                        (cls.__name__, mode, ext, type(path).__name__))
                elif len(formats) != 1:
                    raise RuntimeError(
                        "Multiple %s.%s methods identified for "
                        "file-format %r in form %r" %
                        (cls.__name__, mode, ext, type(path).__name__))
Ejemplo n.º 6
0
Archivo: common.py Proyecto: bfarr/gwpy
def test_io_identify(cls, extensions, modes=['read', 'write']):
    for mode in modes:
        for ext in extensions:
            p = 'X-TEST_CACHE_ENTRY-0-1.%s' % ext
            c = Cache([CacheEntry.from_T050017(p)])
            for path in [p, [p], c[0], c]:
                formats = identify_format(
                    mode, cls, path, None, [], {})
                if len(formats) == 0:
                    raise RuntimeError("No %s.%s method identified for "
                                       "file-format %r in form %r"
                                       % (cls.__name__, mode, ext,
                                          type(path).__name__))
                elif len(formats) != 1:
                    raise RuntimeError("Multiple %s.%s methods identified for "
                                       "file-format %r in form %r"
                                       % (cls.__name__, mode, ext,
                                          type(path).__name__))
Ejemplo n.º 7
0
 def test_on_tape(self):
     self.assertFalse(datafind.on_tape(TEST_GWF_FILE))
     self.assertFalse(datafind.on_tape(
         CacheEntry.from_T050017(TEST_GWF_FILE)))
Ejemplo n.º 8
0
 def test_on_tape(self):
     self.assertFalse(datafind.on_tape(TEST_GWF_FILE))
     self.assertFalse(
         datafind.on_tape(CacheEntry.from_T050017(TEST_GWF_FILE)))