Beispiel #1
0
 def test_single_element(self):
     d = DataAssembly([0],
                      coords={
                          'coordA': ('dim', [0]),
                          'coordB': ('dim', [1])
                      },
                      dims=['dim'])
     d.sel(coordA=0)
     d.sel(coordB=1)
Beispiel #2
0
 def test_incorrect_coord(self):
     d = DataAssembly([0],
                      coords={
                          'coordA': ('dim', [0]),
                          'coordB': ('dim', [1])
                      },
                      dims=['dim'])
     with pytest.raises(KeyError):
         d.sel(coordA=1)
     with pytest.raises(KeyError):
         d.sel(coordB=0)
Beispiel #3
0
 def test_multi_elements(self):
     d = DataAssembly([0, 1, 2, 3, 4],
                      coords={
                          'coordA': ('dim', [0, 1, 2, 3, 4]),
                          'coordB': ('dim', [1, 2, 3, 4, 5])
                      },
                      dims=['dim'])
     d.sel(coordA=0)
     d.sel(coordA=4)
     d.sel(coordB=1)
     d.sel(coordB=5)