コード例 #1
0
def test_subset_only_end():
    end = datetime.strptime('2018-12-16T18:12:26.16614', ISO_DATE)
    gofr = GemObsFileRelationship(TEST_FILE)
    temp = gofr.subset(end=end)
    assert temp is not None, 'should have content'
    assert temp[0].startswith(
        'GEMINI GN-CAL20170616-11-022 2017-06-19T03:21:29.345'), \
        'wrong content'
    assert len(list(temp)) == 416, 'wrong count'

    temp = gofr.subset(end=end, maxrec=3)
    assert temp is not None, 'should have content'
    assert temp[0].startswith(
        'GEMINI GN-CAL20170616-11-022 2017-06-19T03:21:29.345'), \
        'wrong content'
    assert len(list(temp)) == 3, 'wrong maxrec count'
コード例 #2
0
def test_subset_only_start():
    start = datetime.strptime('2018-12-16T03:47:03.939488', ISO_DATE)
    gofr = GemObsFileRelationship(TEST_FILE)
    temp = gofr.subset(start=start)
    assert temp is not None, 'should have content'
    assert temp[0].startswith(
        'GEMINI GN-2018B-FT-113-24-015 2018-12-17T18:08:29.362'), \
        'wrong content'
    assert len(list(temp)) == 97, 'wrong count'

    temp = gofr.subset(start=start, maxrec=3)
    assert temp is not None, 'should have content'
    assert temp[0].startswith(
        'GEMINI GN-2018B-FT-113-24-015 2018-12-17T18:08:29.362'), \
        'wrong content'
    assert len(list(temp)) == 3, 'wrong maxrec count'
コード例 #3
0
def test_subset_start_end():
    start = datetime.strptime('2017-06-20T12:36:35.681662', ISO_DATE)
    end = datetime.strptime('2017-12-17T20:13:56.572387', ISO_DATE)
    test_subject = GemObsFileRelationship(TEST_FILE)
    temp = test_subject.subset(start=start, end=end)
    assert temp is not None, 'should have content'
    assert temp[0].startswith(
        'GEMINI GN-CAL20150925-2-007 2017-06-20T14:50:59.795'), \
        'wrong content'
    assert len(list(temp)) == 314, 'wrong count'

    temp = test_subject.subset(start=start, end=end, maxrec=3)
    assert temp is not None, 'should have content'
    assert temp[0].startswith(
        'GEMINI GN-CAL20150925-2-007 2017-06-20T14:50:59.795'), \
        'wrong content'
    assert len(list(temp)) == 3, 'wrong maxrec count'
コード例 #4
0
def test_subset_all():
    gofr = GemObsFileRelationship(TEST_FILE)
    temp = gofr.subset()
    assert temp is not None, 'should have content'
    assert temp[0].startswith(
        'GEMINI GN-CAL20170616-11-022 2017-06-19T03:21:29.345'), \
        'wrong content'
    assert len(list(temp)) == 513, 'wrong count'
    result = gofr.get_file_names('GN-2015B-Q-1-12-1003')
    assert result == \
           ['N20150807G0044m.fits', 'N20150807G0044i.fits',
            'N20150807G0044.fits'], \
        'entry missing {}'.format(result)