File: test_convert.py

package info (click to toggle)
python-ase 3.22.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 14,344 kB
  • sloc: python: 126,379; xml: 946; makefile: 111; javascript: 47
file content (17 lines) | stat: -rw-r--r-- 497 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from ase.build import bulk
from ase.io import read, write
from ase.calculators.calculator import compare_atoms


def test_convert(tmp_path, cli):
    infile = tmp_path / 'images.json'
    images = [bulk('Si'), bulk('Au')]
    write(infile, images, format='json')

    outfile = tmp_path / 'images.traj'
    cli.ase('convert', str(infile), str(outfile))
    images2 = read(outfile, ':')

    assert len(images2) == 2
    for a1, a2 in zip(images, images2):
        assert not compare_atoms(a1, a2)