コード例 #1
0
def test_gadget_binary():
    header_specs = ['default', 'default+pad32', ['default', 'pad32']]
    for header_spec, endian, fmt in product(header_specs, '<>', [1, 2]):
        fake_snap = fake_gadget_binary(header_spec=header_spec,
                                       endian=endian,
                                       fmt=fmt)
        ds = yt.load(fake_snap, header_spec=header_spec)
        assert isinstance(ds, GadgetDataset)
        ds.field_list
        os.remove(fake_snap)
コード例 #2
0
ファイル: test_outputs.py プロジェクト: tlmnb/yt
def test_gadget_binary():
    header_specs = ['default', 'default+pad32', ['default', 'pad32']]
    for header_spec, endian, fmt in product(header_specs, '<>', [1, 2]):
        fake_snap = fake_gadget_binary(
            header_spec=header_spec,
            endian=endian,
            fmt=fmt
        )
        ds = yt.load(fake_snap, header_spec=header_spec)
        assert isinstance(ds, GadgetDataset)
        ds.field_list
        try:
            os.remove(fake_snap)
        except FileNotFoundError:
            # sometimes this happens for mysterious reasons
            pass
コード例 #3
0
ファイル: test_outputs.py プロジェクト: zackcd/yt
def test_gadget_binary():
    header_specs = ['default', 'default+pad32', ['default', 'pad32']]
    curdir = os.getcwd()
    tmpdir = tempfile.mkdtemp()
    for header_spec, endian, fmt in product(header_specs, '<>', [1, 2]):
        try:
            fake_snap = fake_gadget_binary(header_spec=header_spec,
                                           endian=endian,
                                           fmt=fmt)
        except FileNotFoundError:
            # sometimes this happens for mysterious reasons
            pass
        ds = yt.load(fake_snap, header_spec=header_spec)
        assert isinstance(ds, GadgetDataset)
        ds.field_list
        try:
            os.remove(fake_snap)
        except FileNotFoundError:
            # sometimes this happens for mysterious reasons
            pass
    os.chdir(curdir)
    shutil.rmtree(tmpdir)