File: test_calculator_label.py

package info (click to toggle)
python-ase 3.26.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,484 kB
  • sloc: python: 148,112; xml: 2,728; makefile: 110; javascript: 47
file content (30 lines) | stat: -rw-r--r-- 713 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# fmt: off
from ase.calculators.calculator import Calculator


def test_calculator_label():

    calc = Calculator()
    assert calc.directory == '.'
    assert calc.prefix is None
    assert calc.label is None

    calc.label = 'dir/pref'
    assert calc.directory == 'dir'
    assert calc.prefix == 'pref'
    assert calc.label == 'dir/pref'

    calc.label = 'dir2/'
    assert calc.directory == 'dir2'
    assert calc.prefix is None
    assert calc.label == 'dir2/'

    calc.label = 'hello'
    assert calc.directory == '.'
    assert calc.prefix == 'hello'
    assert calc.label == 'hello'

    calc.label = None
    assert calc.label is None
    assert calc.prefix is None
    assert calc.directory == '.'