<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
3
2a                 @   s   d dl mZ d dlZd dlmZ d dlmZmZ d dlm	Z	 d dl
mZ d dlmZ G dd	 d	ejZG d
d dejZedkrejdd dS )    )outwinN)requires)TkText)	Mbox_func)Func)mockc               @   s\   e Zd Zedd Zedd Zdd Zdd Zd	d
 Zdd Z	dd Z
dd Zdd ZdS )OutputWindowTestc             C   sF   t d t  }| _|j  tjd d d | }| _t| | _|_d S )NZgui)	r   r   rootZwithdrawr   ZOutputWindowwindowr   text)clsr
   w r   0/opt/alt/python36/lib64/python3.6/test_outwin.py
setUpClass   s
    zOutputWindowTest.setUpClassc             C   s$   | j j  | `| ` | jj  | `d S )N)r   closer   r
   Zdestroy)r   r   r   r   tearDownClass   s    

zOutputWindowTest.tearDownClassc             C   s   | j jdd d S )Nz1.0end)r   delete)selfr   r   r   setUp   s    zOutputWindowTest.setUpc             C   s*   | j }| j|jd | j|jt d S )Nztest.txt)r   ZassertFalseZispythonsource__file__)r   r   r   r   r   test_ispythonsource    s    z$OutputWindowTest.test_ispythonsourcec             C   s   | j | jjj d d S )NZOutput)assertEqualr   toptitle)r   r   r   r   test_window_title&   s    z"OutputWindowTest.test_window_titlec             C   sd   | j }| j}t |_d|j_||j d ||jjd d|j_||j d ||jjd |`d S )NFno   Tyes   )r   r   r   Z	get_savedresultZ	maybesavecalled)r   r   eqr   r   r   test_maybesave)   s    zOutputWindowTest.test_maybesavec             C   s  | j }| jj}| jj}| jj}d}|||t| ||dd|j  |dd d}|||t| ||ddd ||ddd |dd d}|||t| ||ddd ||ddd	 |dd d
}|||t| ||ddd ||ddd ||ddd |dd d}d}|||ddt| |||ddt| ||dd| ||dd| ||dd|jd ||dd|jd d S )Ns   Test bytes.z1.0z1.endr   z	test textzinsert linestartzinsert lineendz
test text
 ztest text
Line 2z2.0z2.endzLine 2zLine 2
Zmytag)ZtagsZ	secondtagzmytag.firstz
mytag.lastzsecondtag.firstzsecondtag.last
)	r   r   r   getr   writelendecoderstrip)r   r$   r   r(   r)   bZ	test_textZ
test_text2r   r   r   
test_write7   s@    



zOutputWindowTest.test_writec             C   sb   | j }| jj}| jj}|d ||ddd ||ddd	 ||d
dd ||ddd d S )NLine 1
Line 2
Line 3
z1.0z1.endzLine 1z2.0z2.endzLine 2z3.0z3.endzLine 3zinsert linestartzinsert lineendr&   )r/   r0   r1   )r   r   r(   r   
writelines)r   r$   r(   r2   r   r   r   test_writelinesc   s    z OutputWindowTest.test_writelinesc             C   s
  | j }| j}| j}tj |_t  }|j_t  }|_	|j
d | j|j  ||jd ||jd |j
tt d |j
tt d | j|j  ||jttdf |jdd |j
tt d |j
d | j|j  ||jttd	f |j`|`	d S )
NzNot a file liner   zNo special linez: 42: spam
z
: 21: spam   z1.0r   *   )r   r   r   r   ZMockflistr   Zgotofileliner   	showerrorr)   ZassertIsNoneZgoto_file_liner#   r   strr   argsr   )r   r$   r   r   Zgflr7   r   r   r   test_goto_file_linen   s(    


z$OutputWindowTest.test_goto_file_lineN)__name__
__module____qualname__classmethodr   r   r   r   r   r%   r.   r3   r:   r   r   r   r   r	      s   ,r	   c               @   s2   e Zd Zedd Zdd Zejddd ZdS )	ModuleFunctionTestc             C   s
   d t _d S )N)r   file_line_progs)r   r   r   r   r      s    zModuleFunctionTest.setUpc             C   s6   t j  x(tt jt jD ]\}}| j|j| qW d S )N)r   Zcompile_progszipZfile_line_patsr@   r   pattern)r   ZpatZregexr   r   r   test_compile_progs   s    z%ModuleFunctionTest.test_compile_progszbuiltins.openc             C   sD   t j}d}x4|D ],\}}| j||| |r|j|d d qW d S )N"foo file "testfile1", line 42, bar	testfile1r5   foo testfile2(21) bar	testfile2r4     testfile3  : 42: foo bar\n  testfile3  foo testfile4.py :1: foo testfile4.py r      testfile5: ᧔᧒: 	testfile5testfile6: 42testfile7 42 textr   rrE   r5   rD   rQ   rG   r4   rF   rS   rI   r5   rH   rU   rK   r   rJ   rW   rM   r5   rL   rY   rN   NrO   N)rR   rT   rV   rX   rZ   r[   r\   )r   Zfile_line_helperr   Zassert_called_with)r   Z	mock_openZflhZ
test_lineslineZexpected_outputr   r   r   test_file_line_helper   s          z(ModuleFunctionTest.test_file_line_helperN)	r;   r<   r=   r>   r   rC   r   Zpatchr^   r   r   r   r   r?      s   r?   __main__r!   )	verbosity)Zidlelibr   ZunittestZtest.supportr   Ztkinterr   r   Zidlelib.idle_test.mock_tkr   Zidlelib.idle_test.mock_idler   r   ZTestCaser	   r?   r;   mainr   r   r   r   <module>   s    