o
    2g                     @  sd   d dl mZ d dlZd dlmZmZ d dlmZ d dlm	Z	m
Z
 G dd deZG dd	 d	eZdS )
    )annotationsN)TestCasemockparse_location)_generate_junit_contentsget_terminal_widthc                   @  s    e Zd ZdddZdddZdS )	TestGetTerminalSizereturnNonec              	   C  s   t d}t j }|dd  tjjt d|d2 tjjt j|dd t	 dks,J W d    n1 s6w   Y  W d    d S W d    d S 1 sNw   Y  d S )N)r   r   COLUMNSget_terminal_size)return_valueT)valuesclearP   )
osterminal_sizeenvironcopypopr   patchobjectdictr   )selfretmock_environ r   J/home/garg/my-data/venv/lib/python3.10/site-packages/mypy/test/testutil.py,test_get_terminal_size_in_pty_defaults_to_80   s   

"z@TestGetTerminalSize.test_get_terminal_size_in_pty_defaults_to_80c                 C  s4   t ddddgfksJ t ddg dfksJ d S )NzC:\test.py:1:1z
C:\test.py   zC:\test.py:1:1:1:1)r    r    r    r    r   )r   r   r   r   test_parse_location_windows   s   z/TestGetTerminalSize.test_parse_location_windowsNr
   r   )__name__
__module____qualname__r   r!   r   r   r   r   r	   
   s    
	r	   c                   @  s4   e Zd ZdddZdddZdddZdd	d
ZdS )TestWriteJunitXmlr
   r   c                 C  s.   d}i }d}t d||ddd}||ksJ d S )NFz<?xml version="1.0" encoding="utf-8"?>
<testsuite errors="0" failures="0" name="mypy" skips="0" tests="1" time="1.230">
  <testcase classname="mypy" file="mypy" line="1" name="mypy-py3.14-test-plat" time="1.230">
  </testcase>
</testsuite>
Gz?3.14	test-platdtseriousmessages_by_fileversionplatformr   r   r,   r-   expectedresultr   r   r   test_junit_pass   s   z!TestWriteJunitXml.test_junit_passc                 C  s6   d}dddgi}d}t d||ddd	}||ksJ d S )
NFfile1.pyTest failedzanother line < > &a^  <?xml version="1.0" encoding="utf-8"?>
<testsuite errors="0" failures="1" name="mypy" skips="0" tests="1" time="1.230">
  <testcase classname="mypy" file="file1.py" line="1" name="mypy-py3.14-test-plat file1.py" time="1.230">
    <failure message="mypy produced messages">Test failed
another line &lt; &gt; &amp;</failure>
  </testcase>
</testsuite>
r'   r(   r)   r*   r0   r1   r   r   r    test_junit_fail_escape_xml_chars,   s   z2TestWriteJunitXml.test_junit_fail_escape_xml_charsc                 C  s<   d}ddgddgd}d}t d||d	d
d}||ksJ d S )NFr6   zanother linezAnother failurezline 2)r5   zfile2.pya  <?xml version="1.0" encoding="utf-8"?>
<testsuite errors="0" failures="2" name="mypy" skips="0" tests="2" time="1.230">
  <testcase classname="mypy" file="file1.py" line="1" name="mypy-py3.14-test-plat file1.py" time="1.230">
    <failure message="mypy produced messages">Test failed
another line</failure>
  </testcase>
  <testcase classname="mypy" file="file2.py" line="1" name="mypy-py3.14-test-plat file2.py" time="1.230">
    <failure message="mypy produced messages">Another failure
line 2</failure>
  </testcase>
</testsuite>
r'   r(   r)   r*   r0   r1   r   r   r   test_junit_fail_two_filesB   s   z+TestWriteJunitXml.test_junit_fail_two_filesc                 C  s6   d}d ddgi}d}t d||ddd}||ksJ d S )	NTzError line 1zError line 2aB  <?xml version="1.0" encoding="utf-8"?>
<testsuite errors="1" failures="0" name="mypy" skips="0" tests="1" time="1.230">
  <testcase classname="mypy" file="mypy" line="1" name="mypy-py3.14-test-plat" time="1.230">
    <failure message="mypy produced messages">Error line 1
Error line 2</failure>
  </testcase>
</testsuite>
r'   r(   r)   r*   r0   r1   r   r   r   test_serious_error]   s   z$TestWriteJunitXml.test_serious_errorNr"   )r#   r$   r%   r4   r7   r8   r9   r   r   r   r   r&      s
    


r&   )
__future__r   r   unittestr   r   mypy.inspectionsr   	mypy.utilr   r   r	   r&   r   r   r   r   <module>   s    