File: test_atoms_getitem.py

package info (click to toggle)
python-ase 3.21.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 13,936 kB
  • sloc: python: 122,428; xml: 946; makefile: 111; javascript: 47
file content (17 lines) | stat: -rw-r--r-- 425 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import pytest
from ase.atoms import Atoms


def test_atoms_getitem():
    w = Atoms('H2O',
              positions=[[2.264, 0.639, 0.876],
                         [0.792, 0.955, 0.608],
                         [1.347, 0.487, 1.234]],
              cell=[3, 3, 3],
              pbc=True)

    with pytest.raises(IndexError):
        w[True, False]

    assert(w[0, 1] == w[True, True, False])
    assert(w[0, 1] == w[0:2])