import unittest
import numpy as np
from spglib import get_symmetry_dataset
from vasp import read_vasp
from os import listdir

dirnames = ('cubic',
            'hexagonal',
            'monoclinic',
            'orthorhombic',
            'tetragonal',
            'triclinic',
            'trigonal',
            'distorted',
            'virtual_structure')

class TestSpglib(unittest.TestCase):

    def setUp(self):
        self._filenames = []
        for d in dirnames:
            self._filenames += ["%s/%s" % (d, fname)
                                for fname in listdir("./data/%s" % d)]
    
    def tearDown(self):
        pass
    
    def test_get_symmetry_dataset(self):
        for fname in self._filenames:
            spgnum = int(fname.split('-')[1])
            cell = read_vasp("./data/%s" % fname)
            if 'distorted' in fname:
                dataset = get_symmetry_dataset(cell, symprec=1e-1)
            else:
                dataset = get_symmetry_dataset(cell, symprec=1e-5)
            self.assertEqual(dataset['number'], spgnum)

if __name__ == '__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(TestSpglib)
    unittest.TextTestRunner(verbosity=2).run(suite)
    # unittest.main()

@@ -67,16 +67,29 @@
 _dataset
+, refine_cell
 %0Afrom va
@@ -1073,16 +1073,559 @@
 pgnum)%0A%0A
+    def test_refine_cell(self):%0A        for fname in self._filenames:%0A            spgnum = int(fname.split('-')%5B1%5D)%0A            cell = read_vasp(%22./data/%25s%22 %25 fname)%0A            if 'distorted' in fname:%0A                ref_cell = refine_cell(cell, symprec=1e-1)%0A            else:%0A                ref_cell = refine_cell(cell, symprec=1e-5)%0A            dataset = get_symmetry_dataset(ref_cell, symprec=1e-5)%0A            if dataset%5B'number'%5D != spgnum:%0A                print(%22%25s%22 %25 fname)%0A            self.assertEqual(dataset%5B'number'%5D, spgnum)%0A%0A
 if __nam

Update test for refine_cell