
    Ng	                         d Z ddlZddlZ ej        d           ddlmZ ej        d             Z G d d          ZdS )z+
Tests for static parts of Twitter package
    NtwythonAuthenticatec                      t                      S )Nr        \/var/www/html/ai-engine/env/lib/python3.11/site-packages/nltk/test/unit/test_twitter_auth.pyauthr
      s    >>r   c                       e Zd ZdZed             Zd Zej        	                    dddiddiddii d	d
id	did	did	dig          d             Z
d ZdS )TestCredentialszK
    Tests that Twitter credentials from a file are handled correctly.
    c                     t           j                            t           j                            t                    d          | _        dt           j        d<   d S )Nfilesztwitter-filesTWITTER)ospathjoindirname__file__subdirenviron)selfs    r	   setup_classzTestCredentials.setup_class   s9    gll27??8#<#<gFF /
9r   c                 ~    t           j                            |j                  }|t           j        d         k    sJ dS )zI
        Test that environment variable has been read correctly.
        r   N)r   r   basenamecreds_subdirr   )r   r
   fns      r	   test_environmentz TestCredentials.test_environment   s:     Wd/00RZ	*******r   kwargsr    Nz
/nosuchdir
creds_filefoobarzbad_oauth1-1.txtzbad_oauth1-2.txtzbad_oauth1-3.txtc                     	  |j         di | t          j        d           dS # t          t          f$ r Y dS t
          $ r"}t          j        d|z             Y d}~dS d}~ww xY w)z*Various scenarios that should raise errorszOSError exception not thrown.zUnexpected exception thrown: %sNr   )
load_credspytestfailOSError
ValueError	Exception)r   r   r
   es       r	   'test_scenarios_that_should_raise_errorsz7TestCredentials.test_scenarios_that_should_raise_errors$   s    0		9DO%%f%%% K788888 $ 	 	 	DD 	? 	? 	?K9A=>>>>>>>>>	?s   % A$	A$AA$c                     |                     | j                  }|j        t          j                            | j        |j                  k    sJ |j        dk    sJ |d         dk    sJ dS )z6Test that a proper file succeeds and is read correctly)r   zcredentials.txtapp_keyaN)r#   r   creds_fullpathr   r   r   r    )r   r
   oauths      r	   test_correct_filez!TestCredentials.test_correct_fileG   so    t{33"bgll4;&P&PPPPP"33333Y3&&&&&&r   )__name__
__module____qualname____doc__classmethodr   r   r$   markparametrizer*   r0   r   r   r	   r   r      s          0 0 [0+ + + [ rNt|$8$-.-.-.#	
 ,9 9- ,9' ' ' ' 'r   r   )	r4   r   r$   importorskipnltk.twitterr   fixturer
   r   r   r   r	   <module>r;      s     
			   I    % % % % % %   :' :' :' :' :' :' :' :' :' :'r   