# Path: vasppy/kpoints.py
# class AutoKPoints:
#     """
#     class for automatic k-point generation data in KPOINTS.
#     """
# 
#     def __init__(self,
#                  title: str,
#                  subdivisions: np.ndarray,
#                  grid_centering: Optional[str] = 'G',
#                  shift: Optional[np.ndarray] = np.array([0., 0., 0.])) -> None:
#         """
#         Initialise an AutoKPoints object
# 
#         Args:
#             title (Str): The first line of the file, treated as a comment by VASP.
#             subdivisions: (np.Array( Int, Int, Int )): Numbers of subdivisions along each reciprocal lattice vector.
#             grid_centering (Str, optional): Specify gamma-centered (G) or the original Monkhorst-Pack scheme (MP). Default is 'G'.
#             shift: (np.Array( Float, Float, Float ), optional): Optional shift of the mesh (s_1, s_2, s_3). Default is ( [ 0., 0., 0. ] ).
# 
#         Returns:
#             None
#         """
#         accepted_grid_centerings = ['G', 'MP']
#         if grid_centering not in accepted_grid_centerings:
#             raise ValueError
#         self.title = title
#         self.grid_centering = grid_centering
#         self.subdivisions = subdivisions
#         self.shift = shift


import unittest
import numpy as np
from unittest.mock import Mock, patch, mock_open
from vasppy.kpoints import AutoKPoints


class AutoKPointsTestCase( unittest.TestCase ):

    def test_init_auto_kpoints( self ):
        title = 'title'
        subdivisions = np.array( [ 2, 2, 2 ] )
        auto_kpoints = AutoKPoints( title, subdivisions )
        self.assertEqual( auto_kpoints.title, title )
        np.testing.assert_array_equal( auto_kpoints.subdivisions, subdivisions )
        np.testing.assert_array_equal( auto_kpoints.grid_centering, 'G' )
        np.testing.assert_array_equal( auto_kpoints.shift, np.array( [ 0.0, 0.0, 0.0 ] ) )

    def test_init_auto_kpoints_mp( self ):
        title = 'title'
        subdivisions = np.array( [ 2, 2, 2 ] )
        grid_centering = 'MP'

# Path: vasppy/kpoints.py
# class AutoKPoints:
#     """
#     class for automatic k-point generation data in KPOINTS.
#     """
# 
#     def __init__(self,
#                  title: str,
#                  subdivisions: np.ndarray,
#                  grid_centering: Optional[str] = 'G',
#                  shift: Optional[np.ndarray] = np.array([0., 0., 0.])) -> None:
#         """
#         Initialise an AutoKPoints object
# 
#         Args:
#             title (Str): The first line of the file, treated as a comment by VASP.
#             subdivisions: (np.Array( Int, Int, Int )): Numbers of subdivisions along each reciprocal lattice vector.
#             grid_centering (Str, optional): Specify gamma-centered (G) or the original Monkhorst-Pack scheme (MP). Default is 'G'.
#             shift: (np.Array( Float, Float, Float ), optional): Optional shift of the mesh (s_1, s_2, s_3). Default is ( [ 0., 0., 0. ] ).
# 
#         Returns:
#             None
#         """
#         accepted_grid_centerings = ['G', 'MP']
#         if grid_centering not in accepted_grid_centerings:
#             raise ValueError
#         self.title = title
#         self.grid_centering = grid_centering
#         self.subdivisions = subdivisions
#         self.shift = shift


# Path: tests/test_kpoints.py
import unittest
import numpy as np
from unittest.mock import Mock, patch, mock_open
from vasppy.kpoints import AutoKPoints



class AutoKPointsTestCase( unittest.TestCase ):

    def test_init_auto_kpoints( self ):
        title = 'title'
        subdivisions = np.array( [ 2, 2, 2 ] )
        auto_kpoints = AutoKPoints( title, subdivisions )
        self.assertEqual( auto_kpoints.title, title )
        np.testing.assert_array_equal( auto_kpoints.subdivisions, subdivisions )
        np.testing.assert_array_equal( auto_kpoints.grid_centering, 'G' )
        np.testing.assert_array_equal( auto_kpoints.shift, np.array( [ 0.0, 0.0, 0.0 ] ) )

    def test_init_auto_kpoints_mp( self ):
        title = 'title'
        subdivisions = np.array( [ 2, 2, 2 ] )
        grid_centering = 'MP'

        auto_kpoints = AutoKPoints( title, subdivisions, grid_centering=grid_centering )