File: test_ccdc.py

package info (click to toggle)
finalcif 137%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 43,544 kB
  • sloc: python: 49,119; cpp: 67; sh: 51; makefile: 22
file content (38 lines) | stat: -rw-r--r-- 1,409 bytes parent folder | download | duplicates (3)
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
31
32
33
34
35
36
37
38
#   ----------------------------------------------------------------------------
#   "THE BEER-WARE LICENSE" (Revision 42):
#   Daniel Kratzert <dkratzert@gmx.de> wrote this file.  As long as you retain
#   this notice you can do whatever you want with this stuff. If we meet some day,
#   and you think this stuff is worth it, you can buy me a beer in return.
#   ----------------------------------------------------------------------------
import os
import unittest
from pathlib import Path

from finalcif.cif.cif_file_io import CifContainer
from finalcif.datafiles.ccdc_mail import CCDCMail

data = Path('.')


class TestCCDC(unittest.TestCase):
    def setUp(self) -> None:
        self.cif = CifContainer(file=data / 'tests/examples/work/cu_BruecknerJK_153F40_0m.cif')

    def test_ccdc_num(self):
        ccdc = CCDCMail(self.cif)
        self.assertEqual(1979688, ccdc.depnum)
        self.assertEqual('CCDC Depository Request.eml', ccdc.emlfile.name)


class TestCCDCnoMail(unittest.TestCase):
    def setUp(self) -> None:
        self.cif = CifContainer(file=data / 'test-data/DK_Zucker2_0m.cif')

    def test_ccdc_num(self):
        ccdc = CCDCMail(self.cif)
        self.assertEqual(0, ccdc.depnum)
        self.assertEqual('', ccdc.emlfile.name)

    def test_same_cell(self):
        ccdc = CCDCMail(self.cif)
        self.assertEqual(True, ccdc.is_same_cell(self.cif, [7.716, 8.664, 10.812]))