
    bi                     ^    d Z ddlZddlmZmZmZ ddlmZmZ  G d dej                        Z
y)a,  
Copyright 2013 Steven Diamond

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
    N)ConstantVariablelog)QUASILINEARUNKNOWNc                   @    e Zd ZdZd	dZd	dZd	dZd	dZd	dZd	dZ	y)
TestCurvaturez0 Unit tests for the expression/curvature class. Nc                 \   t               dz  | _        t               dz  | _        t               | _        t	        d      | _        t        t               dz        | _        t	        d      | _        t	        d      | _	        t	        d      | _
        | j                  | j                  z   | _        y )N   g      ?         r   )r   cvxccvaffr   constr   unknown_curvposnegzerounknown_signselfs    U/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/cvxpy/tests/test_curvature.pysetUpzTestCurvature.setUp   sy    :q=:s?:a[

A.A;B<QK	 HHtxx/    c                    | j                  | j                  | j                  z   j                  | j                  j                         | j                  | j                  | j
                  z   j                  t               | j                  | j                  | j
                  z   j                  t               | j                  | j                  | j                  z   j                  | j                  j                         | j                  | j                  | j
                  z   j                  | j
                  j                         y N)assertEqualr   r   	curvaturer   r   r   r   r   s    r   test_addzTestCurvature.test_add&   s    $**txx/::DHH<N<NO$++dhh6AA7K$((TXX-88'B$((TXX-88$((:L:LM$((TXX-88$((:L:LMr   c                    | j                  | j                  | j                  z
  j                  | j                  j                         | j                  | j
                  | j                  z
  j                  t               | j                  | j                  | j                  z
  j                  | j                  j                         | j                  | j                  | j                  z
  j                  t               | j                  | j                  | j                  z
  j                  | j                  j                         y r   )r    r   r   r!   r   r   r   r   r   s    r   test_subzTestCurvature.test_sub-   s    $**txx/::DHH<N<NO$++dhh6AA7K$((TXX-88$((:L:LM$((TXX-88'B$((TXX-88$((:L:LMr   c                 4   | j                  | j                  | j                  z  j                  | j                  j                         | j                  | j
                  | j                  z  j                  | j                  j                         | j                  | j
                  | j                  z  j                  | j                  j                         | j                  | j
                  | j                  z  j                  t               | j                  | j                  | j                  z  j                  | j                  j                         | j                  | j                  | j                  z  j                  | j                  j                         | j                  | j                  | j                  z  j                  | j                  j                         | j                  | j                  | j                  z  j                  t               y r   )r    r   r   r!   r   r   r   r   r   r   r   r   r   r   s    r   test_sign_multzTestCurvature.test_sign_mult4   s\   $))dhh.99488;M;MN$((488+668J8JK$((488+668J8JK$((4#4#44??M$((488+668J8JK$((488+668J8JK$++DJJ6AA4::CWCWX$++DHH4??Ir   c                     | j                  | j                   j                  | j                  j                         | j                  | j                   j                  | j                  j                         y r   )r    r   r!   r   r   r   s    r   test_negzTestCurvature.test_neg>   sN    488)..0B0BC488)..0B0BCr   c                 L   | j                   j                         sJ | j                  j                         sJ | j                  j                         rJ | j                  j                         rJ | j
                  j                         rJ | j                   j                         sJ | j                  j                         sJ | j                  j                         sJ | j                  j                         rJ | j
                  j                         rJ | j                   j                         sJ | j                  j                         sJ | j                  j                         rJ | j                  j                         sJ | j
                  j                         rJ y r   )r   	is_affiner   r   r   r   	is_convex
is_concaver   s    r   test_is_curvaturezTestCurvature.test_is_curvatureC   sU   zz##%%%xx!!###88%%'''88%%'''$$..000zz##%%%xx!!###xx!!###88%%'''$$..000zz$$&&&xx""$$$88&&(((xx""$$$$$//1111r   )returnN)
__name__
__module____qualname____doc__r   r"   r$   r&   r(   r-    r   r   r	   r	      s'    :
0NNJD
2r   r	   )r2   unittestcvxpyr   r   r   cvxpy.settingsr   r   TestCaser	   r3   r   r   <module>r8      s*      ) ) /=2H%% =2r   