Exemple #1
0
 def test_atrs(self):
     fdict = FrozenDict({"a": 1})
     for atr in ("keys", "items", "values"):
         try:
             getattr(fdict, atr)
             assert True
         except:
             assert False
Exemple #2
0
    AttrKeyField,
    VariableKeyField,
    DimensionKeyField,
)
from segysak._seismic_dataset import (
    create_seismic_dataset,
    create3d_dataset,
    _dataset_coordinate_helper,
)

# from segysak.seisnc import create_empty_seisnc, set_seisnc_dims
from segysak.tools import check_crop, check_zcrop
from segysak._accessor import open_seisnc
from segysak._core import FrozenDict

KNOWN_BYTES = FrozenDict(KNOWN_BYTES)

from ._segy_headers import segy_bin_scrape, segy_header_scrape, what_geometry_am_i
from ._segy_text import get_segy_texthead
from ._segy_globals import _SEGY_MEASUREMENT_SYSTEM


class SegyLoadError(Exception):
    def __init__(self, message, errors):

        # Call the base class constructor with the parameters it needs
        super().__init__(message)

        # Now for your custom code...
        self.errors = errors
Exemple #3
0
 def test_init(self):
     fdict = FrozenDict({"a": 1})
     assert isinstance(fdict, FrozenDict)
Exemple #4
0
 def test_fromkeys(self):
     fdict = FrozenDict().fromkeys(["a"], [1])
     assert isinstance(fdict, FrozenDict)
Exemple #5
0
 def test_repr(self):
     fdict = FrozenDict({"a": 1})
     assert isinstance(str(fdict), str)
Exemple #6
0
 def test_hash(self):
     fdict = FrozenDict({"a": 1})
     assert isinstance(fdict.__hash__(), int)
Exemple #7
0
 def test_removed_atrs(self):
     fdict = FrozenDict({"a": 1})
     for atr in ("clear", "update", "pop", "popitem", "setdefault"):
         with pytest.raises(AttributeError):
             getattr(fdict, atr)
Exemple #8
0
 def test_del_item(self):
     fdict = FrozenDict({"a": 1})
     with pytest.raises(TypeError):
         del fdict["a"]
Exemple #9
0
 def test_noset_item(self):
     fdict = FrozenDict({"a": 1})
     with pytest.raises(TypeError):
         fdict["b"] = 2