• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

materialsproject / pymatgen / 4075885785

pending completion
4075885785

push

github

Shyue Ping Ong
Merge branch 'master' of github.com:materialsproject/pymatgen

96 of 96 new or added lines in 27 files covered. (100.0%)

81013 of 102710 relevant lines covered (78.88%)

0.79 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.43
/pymatgen/io/tests/test_cssr.py
1
# Copyright (c) Pymatgen Development Team.
2
# Distributed under the terms of the MIT License.
3

4
"""
1✔
5
Created on Jan 24, 2012
6
"""
7

8

9
from __future__ import annotations
1✔
10

11
import os
1✔
12
import unittest
1✔
13

14
from pymatgen.core.structure import Structure
1✔
15
from pymatgen.io.cssr import Cssr
1✔
16
from pymatgen.io.vasp.inputs import Poscar
1✔
17
from pymatgen.util.testing import PymatgenTest
1✔
18

19
__author__ = "Shyue Ping Ong"
1✔
20
__copyright__ = "Copyright 2012, The Materials Project"
1✔
21
__version__ = "0.1"
1✔
22
__maintainer__ = "Shyue Ping Ong"
1✔
23
__email__ = "shyuep@gmail.com"
1✔
24
__date__ = "Jan 24, 2012"
1✔
25

26

27
class CssrTest(unittest.TestCase):
1✔
28
    def setUp(self):
1✔
29
        filepath = os.path.join(PymatgenTest.TEST_FILES_DIR, "POSCAR")
1✔
30
        p = Poscar.from_file(filepath)
1✔
31
        self.cssr = Cssr(p.structure)
1✔
32

33
    def test_str(self):
1✔
34
        expected_string = """10.4118 6.0672 4.7595
1✔
35
90.00 90.00 90.00 SPGR =  1 P 1    OPT = 1
36
24 0
37
0 Fe4 P4 O16
38
1 Fe 0.2187 0.7500 0.4749
39
2 Fe 0.2813 0.2500 0.9749
40
3 Fe 0.7187 0.7500 0.0251
41
4 Fe 0.7813 0.2500 0.5251
42
5 P 0.0946 0.2500 0.4182
43
6 P 0.4054 0.7500 0.9182
44
7 P 0.5946 0.2500 0.0818
45
8 P 0.9054 0.7500 0.5818
46
9 O 0.0434 0.7500 0.7071
47
10 O 0.0966 0.2500 0.7413
48
11 O 0.1657 0.0461 0.2854
49
12 O 0.1657 0.4539 0.2854
50
13 O 0.3343 0.5461 0.7854
51
14 O 0.3343 0.9539 0.7854
52
15 O 0.4034 0.7500 0.2413
53
16 O 0.4566 0.2500 0.2071
54
17 O 0.5434 0.7500 0.7929
55
18 O 0.5966 0.2500 0.7587
56
19 O 0.6657 0.0461 0.2146
57
20 O 0.6657 0.4539 0.2146
58
21 O 0.8343 0.5461 0.7146
59
22 O 0.8343 0.9539 0.7146
60
23 O 0.9034 0.7500 0.2587
61
24 O 0.9566 0.2500 0.2929"""
62
        assert str(self.cssr) == expected_string
1✔
63

64
    def test_from_file(self):
1✔
65
        filename = os.path.join(PymatgenTest.TEST_FILES_DIR, "Si.cssr")
1✔
66
        cssr = Cssr.from_file(filename)
1✔
67
        assert isinstance(cssr.structure, Structure)
1✔
68

69

70
if __name__ == "__main__":
1✔
71
    unittest.main()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc