File: //usr/local/lib/python3.7/test/test_email/__pycache__/test_parser.cpython-37.opt-2.pyc
B
��g� � @ s� d dl Z d dlZd dlZd dlmZmZ d dlmZ d dlm Z G dd� de �Z
G dd� d�Zd d
� ZG dd� dee �Z
d
d� Zdd� ZG dd� dee �Zedkr�e�� dS )� N)�Message�EmailMessage)�default)�
TestEmailBasec @ s: e Zd ZG dd� de�Zejjdd�Zdd� Z dd� Z
d S )
�TestCustomMessagec s e Zd Z� fdd�Z� ZS )zTestCustomMessage.MyMessagec s || _ t� �� d S )N)�check_policy�super�__init__)�self�policy)� __class__� �7/usr/local/lib/python3.7/test/test_email/test_parser.pyr s z$TestCustomMessage.MyMessage.__init__)�__name__�
__module__�__qualname__r �
__classcell__r
r
)r r � MyMessage s r Zboo)�linesepc C s6 t jd| j| jd�}| �|| j� | �|j| j� d S )NzSubject: bogus
msg
)r )�email�message_from_stringr �MyPolicy�assertIsInstance�assertIsr )r
�msgr
r
r �7test_custom_message_gets_policy_if_possible_from_string s
zITestCustomMessage.test_custom_message_gets_policy_if_possible_from_stringc C s@ t �d�}tj|| j| jd�}| �|| j� | �|j| j� d S )NzSubject: bogus
msg
)r ) �io�StringIOr �message_from_filer r r r r )r
Zsource_filer r
r
r �5test_custom_message_gets_policy_if_possible_from_file s
zGTestCustomMessage.test_custom_message_gets_policy_if_possible_from_fileN)r r r r r r r �cloner r r r
r
r
r r s r c @ s4 e Zd Zdd� ZG dd� de�Zdd� Zdd� Zd S )
�TestParserBasec C sl xf| j D ]\}| j|jd��D |dtd�}| �|�� dddddd d
ddg � | �|�� d
� W d Q R X qW d S )N)�parseru� Next-Line: not
broken
Null: not broken
Vertical-Tab: notbroken
Form-Feed: notbroken
File-Separator: notbroken
Group-Separator: notbroken
Record-Separator: notbroken
Line-Separator: not
broken
Paragraph-Separator: not
broken
)r )z Next-Lineu not
broken)ZNullz
not broken)zVertical-Tabz
notbroken)z Form-Feedz
notbroken)zFile-Separatorz
notbroken)zGroup-Separatorz
notbroken)zRecord-Separatorz
notbroken)zLine-Separatoru not
broken)zParagraph-Separatoru not
broken� )�parsers�subTestr r ZassertEqual�itemsZget_payload)r
r"