


import logging

# standard libraries
import sys

import numpy as np
import pytest  # type: ignore

# Custom/local libraries
from matrix import matrix_operation as matop

__UpperCAmelCase			:			List[str]			      =					[[12, 10], [3, 9]]
__UpperCAmelCase			:			List[Any]			      =					[[3, 4], [7, 4]]
__UpperCAmelCase			:			List[str]			      =					[[3, 0, 2], [2, 0, -2], [0, 1, 1]]
__UpperCAmelCase			:			Tuple			      =					[[3, 0, -2], [2, 0, 2], [0, 1, 1]]
__UpperCAmelCase			:			List[Any]			      =					[[3, 0, 2], [2, 0, -2], [0, 1, 1], [2, 0, -2]]
__UpperCAmelCase			:			str			      =					[1]
__UpperCAmelCase			:			int			      =					[2]

__UpperCAmelCase			:			int			      =					logging.getLogger()
__UpperCAmelCase			:			int			      =					logging.DEBUG
__UpperCAmelCase			:			int			      =					logging.StreamHandler(sys.stdout)
logger.addHandler(stream_handler)


@pytest.mark.mat_ops
@pytest.mark.parametrize(
    ('''mat1''', '''mat2''')				,      [(mat_a, mat_b), (mat_c, mat_d), (mat_d, mat_e), (mat_f, mat_h)]							)
def   a						(				SCREAMING_SNAKE_CASE_   :		int				,      SCREAMING_SNAKE_CASE_   :		str							):






       """simple docstring"""





       if (np.array(SCREAMING_SNAKE_CASE_							)).shape < (2, 2) or (np.array(SCREAMING_SNAKE_CASE_							)).shape < (2, 2):
              with pytest.raises(SCREAMING_SNAKE_CASE_							):
                     logger.info(F"""\n\t{test_addition.__name__} returned integer"""							)
                     matop.add(SCREAMING_SNAKE_CASE_				,      SCREAMING_SNAKE_CASE_							)
       elif (np.array(SCREAMING_SNAKE_CASE_							)).shape == (np.array(SCREAMING_SNAKE_CASE_							)).shape:
              logger.info(F"""\n\t{test_addition.__name__} with same matrix dims"""							)
              UpperCamelCase     :						Union[str, Any] 						=		(np.array(SCREAMING_SNAKE_CASE_							) + np.array(SCREAMING_SNAKE_CASE_							)).tolist()
              UpperCamelCase     :						str 						=		matop.add(SCREAMING_SNAKE_CASE_				,      SCREAMING_SNAKE_CASE_							)
              assert theo == act
       else:
              with pytest.raises(SCREAMING_SNAKE_CASE_							):
                     logger.info(F"""\n\t{test_addition.__name__} with different matrix dims"""							)
                     matop.add(SCREAMING_SNAKE_CASE_				,      SCREAMING_SNAKE_CASE_							)


@pytest.mark.mat_ops
@pytest.mark.parametrize(
    ('''mat1''', '''mat2''')				,      [(mat_a, mat_b), (mat_c, mat_d), (mat_d, mat_e), (mat_f, mat_h)]							)
def   a						(				SCREAMING_SNAKE_CASE_   :		Dict				,      SCREAMING_SNAKE_CASE_   :		int							):






       """simple docstring"""





       if (np.array(SCREAMING_SNAKE_CASE_							)).shape < (2, 2) or (np.array(SCREAMING_SNAKE_CASE_							)).shape < (2, 2):
              with pytest.raises(SCREAMING_SNAKE_CASE_							):
                     logger.info(F"""\n\t{test_subtraction.__name__} returned integer"""							)
                     matop.subtract(SCREAMING_SNAKE_CASE_				,      SCREAMING_SNAKE_CASE_							)
       elif (np.array(SCREAMING_SNAKE_CASE_							)).shape == (np.array(SCREAMING_SNAKE_CASE_							)).shape:
              logger.info(F"""\n\t{test_subtraction.__name__} with same matrix dims"""							)
              UpperCamelCase     :						List[str] 						=		(np.array(SCREAMING_SNAKE_CASE_							) - np.array(SCREAMING_SNAKE_CASE_							)).tolist()
              UpperCamelCase     :						Union[str, Any] 						=		matop.subtract(SCREAMING_SNAKE_CASE_				,      SCREAMING_SNAKE_CASE_							)
              assert theo == act
       else:
              with pytest.raises(SCREAMING_SNAKE_CASE_							):
                     logger.info(F"""\n\t{test_subtraction.__name__} with different matrix dims"""							)
                     assert matop.subtract(SCREAMING_SNAKE_CASE_				,      SCREAMING_SNAKE_CASE_							)


@pytest.mark.mat_ops
@pytest.mark.parametrize(
    ('''mat1''', '''mat2''')				,      [(mat_a, mat_b), (mat_c, mat_d), (mat_d, mat_e), (mat_f, mat_h)]							)
def   a						(				SCREAMING_SNAKE_CASE_   :		Optional[int]				,      SCREAMING_SNAKE_CASE_   :		Optional[Any]							):






       """simple docstring"""





       if (np.array(SCREAMING_SNAKE_CASE_							)).shape < (2, 2) or (np.array(SCREAMING_SNAKE_CASE_							)).shape < (2, 2):
              logger.info(F"""\n\t{test_multiplication.__name__} returned integer"""							)
              with pytest.raises(SCREAMING_SNAKE_CASE_							):
                     matop.add(SCREAMING_SNAKE_CASE_				,      SCREAMING_SNAKE_CASE_							)
       elif (np.array(SCREAMING_SNAKE_CASE_							)).shape == (np.array(SCREAMING_SNAKE_CASE_							)).shape:
              logger.info(F"""\n\t{test_multiplication.__name__} meets dim requirements"""							)
              UpperCamelCase     :						Optional[Any] 						=		(np.matmul(SCREAMING_SNAKE_CASE_				,      SCREAMING_SNAKE_CASE_							)).tolist()
              UpperCamelCase     :						Optional[int] 						=		matop.multiply(SCREAMING_SNAKE_CASE_				,      SCREAMING_SNAKE_CASE_							)
              assert theo == act
       else:
              with pytest.raises(SCREAMING_SNAKE_CASE_							):
                     logger.info(
                         F"""\n\t{test_multiplication.__name__} does not meet dim requirements"""							)
                     assert matop.subtract(SCREAMING_SNAKE_CASE_				,      SCREAMING_SNAKE_CASE_							)


@pytest.mark.mat_ops
def   a						(				):






       """simple docstring"""





       UpperCamelCase     :						Any 						=		(3.5 * np.array(SCREAMING_SNAKE_CASE_							)).tolist()
       UpperCamelCase     :						str 						=		matop.scalar_multiply(SCREAMING_SNAKE_CASE_				,      3.5							)
       assert theo == act


@pytest.mark.mat_ops
def   a						(				):






       """simple docstring"""





       UpperCamelCase     :						List[str] 						=		(np.identity(5							)).tolist()
       UpperCamelCase     :						List[Any] 						=		matop.identity(5							)
       assert theo == act


@pytest.mark.mat_ops
@pytest.mark.parametrize('''mat'''				,      [mat_a, mat_b, mat_c, mat_d, mat_e, mat_f]							)
def   a						(				SCREAMING_SNAKE_CASE_   :		Any							):






       """simple docstring"""





       if (np.array(SCREAMING_SNAKE_CASE_							)).shape < (2, 2):
              with pytest.raises(SCREAMING_SNAKE_CASE_							):
                     logger.info(F"""\n\t{test_transpose.__name__} returned integer"""							)
                     matop.transpose(SCREAMING_SNAKE_CASE_							)
       else:
              UpperCamelCase     :						Union[str, Any] 						=		(np.transpose(SCREAMING_SNAKE_CASE_							)).tolist()
              UpperCamelCase     :						str 						=		matop.transpose(SCREAMING_SNAKE_CASE_				,      return_map=SCREAMING_SNAKE_CASE_							)
              assert theo == act









def    a__    (	A       ):
   return int(A       ) if x - int(A       ) >= 0 else int(A       ) - 1


if __name__ == "__main__":
 import doctest

 doctest.testmod()


