403Webshell
Server IP : 50.21.180.56  /  Your IP : 216.73.216.193
Web Server : Apache
System : Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User : ws67922704 ( 67922704)
PHP Version : 8.5.13
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /kunden/lib/python3/dist-packages/breezy/bzr/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /kunden/lib/python3/dist-packages/breezy/bzr/tests/__pycache__/test_pack.cpython-313.pyc
�

p��g`w���SrSSKJr SSKJr SSKJr "SS\R5r"S	S
\R5r"SS\R5r	"S
S\R5r
"SS\R5r"SS\R5r
"SS\R5r"SS\5r"SS\5r"SS\R5rg)zTests for breezy.pack.�)�BytesIO�)�tests�)�packc�N�\rSrSrSrSrSrSrSrSr	Sr
S	rS
rSr
Srg
)�TestContainerSerialiser�z(Tests for the ContainerSerialiser class.c�.�[R"5 g)z(Test constructing a ContainerSerialiser.N)r�ContainerSerialiser��selfs �</usr/lib/python3/dist-packages/breezy/bzr/tests/test_pack.py�test_construct�&TestContainerSerialiser.test_construct���� � �"�c�n�[R"5nURSUR55 g�N�*Bazaar pack format 1 (introduced in 0.18)
)rr�assertEqual�begin�r�
serialisers  r�
test_begin�"TestContainerSerialiser.test_begin s,���-�-�/�
����:�J�<L�<L�<N�	
rc�n�[R"5nURSUR55 g)N�E)rrr�endrs  r�test_end� TestContainerSerialiser.test_end&s'���-�-�/�
�����z�~�~�/�0rc�v�[R"5nURS/5nURSU5 g)N�bytess	B5

bytes�rr�bytes_recordr�rr�records   r�test_bytes_record_no_name�1TestContainerSerialiser.test_bytes_record_no_name*s2���-�-�/�
��(�(��2�6�������0rc�x�[R"5nURSS/5nURSU5 g)Nr#)snamesB5
name

bytesr$r&s   r�(test_bytes_record_one_name_with_one_part�@TestContainerSerialiser.test_bytes_record_one_name_with_one_part/s5���-�-�/�
��(�(��J�<�@�����-�v�6rc�x�[R"5nURSS/5nURSU5 g)Nr#)spart1spart2sB5
part1part2

bytesr$r&s   r�)test_bytes_record_one_name_with_two_parts�ATestContainerSerialiser.test_bytes_record_one_name_with_two_parts4s7���-�-�/�
��(�(��4H�3I�J�����7��@rc�z�[R"5nURSSS/5nURSU5 g)Nr#��name1��name2sB5
name1
name2

bytesr$r&s   r�test_bytes_record_two_names�3TestContainerSerialiser.test_bytes_record_two_names9s8���-�-�/�
��(�(��K��3M�N�����5�v�>rc��[R"5nUR[RURSS/5 g)Nr#�sbad name)rr�assertRaises�InvalidRecordErrorr%rs  r�)test_bytes_record_whitespace_in_name_part�ATestContainerSerialiser.test_bytes_record_whitespace_in_name_part>s6���-�-�/�
�����#�#�Z�%<�%<�h��HX�	
rc�z�[R"5nURSSS/5nURSU5 g)N� r1r3sB32
name1
name2

)rr�bytes_headerrr&s   r�test_bytes_record_header�0TestContainerSerialiser.test_bytes_record_headerDs8���-�-�/�
��(�(��k�;�-G�H�����1�6�:r�N)�__name__�
__module__�__qualname__�__firstlineno__�__doc__rrr r(r+r.r5r;r@�__static_attributes__rBrrr	r	s3��2�#�
�1�1�
7�
A�
?�

�;rr	c�^�\rSrSrU4SjrSrSrSrSrSr	Sr
S	rS
rSr
SrS
rSrSrSrSrSrU=r$)�TestContainerWriter�Jc�>�[TU]5 [5Ul[R
"URR5Ulg�N)�super�setUpr�outputr�ContainerWriter�write�writer)r�	__class__s �rrO�TestContainerWriter.setUpKs1���
��
���i����*�*�4�;�;�+<�+<�=��rc�V�URXRR55 g)zSAssert that the output of self.writer ContainerWriter is equal to
expected_output.
N)rrP�getvalue)r�expected_outputs  r�assertOutput� TestContainerWriter.assertOutputPs��	
����+�+�*>�*>�*@�Arc�0�[R"S5 g)z�Test constructing a ContainerWriter.

This uses None as the output stream to show that the constructor
doesn't try to use the output stream.
N)rrQr
s rr�"TestContainerWriter.test_constructV���	
���T�"rc�Z�URR5 URS5 g)z;The begin() method writes the container format marker line.rN)rSrrYr
s rr�TestContainerWriter.test_begin^s!�����������H�Irc��URR5 URSURR5 g)z4After begin is written, 0 records have been written.rN)rSrr�records_writtenr
s r�%test_zero_records_written_after_begin�9TestContainerWriter.test_zero_records_written_after_begincs,������������D�K�K�7�7�8rc��URR5 URR5 URS5 g)z-The end() method writes an End Marker record.�+Bazaar pack format 1 (introduced in 0.18)
EN)rSrrrYr
s rr �TestContainerWriter.test_endhs/�����������������I�Jrc��URR5 URR5 URSURR5 g)�<The end() method does not count towards the records written.rN)rSrrrrar
s r�7test_empty_end_does_not_add_a_record_to_records_written�KTestContainerWriter.test_empty_end_does_not_add_a_record_to_records_writtenns:������������������D�K�K�7�7�8rc��URR5 URRS/[S5/S9 URR	5 URSURR5 g)rh�foo��names�N)rSr�add_bytes_record�lenrrrar
s r�;test_non_empty_end_does_not_add_a_record_to_records_written�OTestContainerWriter.test_non_empty_end_does_not_add_a_record_to_records_writtentsY�����������$�$�f�X�s�6�{�"�$�E�����������D�K�K�7�7�8rc���URR5 URRS/[S5/S9upUR	SX45 URS5 g)z Add a bytes record with no name.�abcrm)�*�s1Bazaar pack format 1 (introduced in 0.18)
B3

abcN�rSrrprqrrY�r�offset�lengths   r�test_add_bytes_record_no_name�1TestContainerWriter.test_add_bytes_record_no_name{sX�����������5�5�v�h��F��SU�5�V�������6�"2�3����Q�Rrc���URR5 URRS/[S5S/S9upUR	SX45 URS5 g)z!Add a bytes record with one name.rur1rm)rv�
s7Bazaar pack format 1 (introduced in 0.18)
B3
name1

abcNrxrys   r�test_add_bytes_record_one_name�2TestContainerWriter.test_add_bytes_record_one_name�sb�����������5�5�
�H�c�&�k�+��6�
���	
����F�#3�4����J�	
rc�|^^�/mURRmUU4SjnXRlSURlURR5 URR	S/[S5S/S9up#UR
SX#45 URS5 UR
/SQT5 g	)
z-Write a large record which does multiple IOs.c�6>�TRU5 T"U5$rM)�append)�data�
real_write�writess ��r�
record_writes�MTestContainerWriter.test_add_bytes_record_split_writes.<locals>.record_writes�s����M�M�$���d�#�#rr�abcabcr1rm)rv�s:Bazaar pack format 1 (introduced in 0.18)
B6
name1

abcabc)rs
B6
name1

r�N)rS�
write_func�_JOIN_WRITES_THRESHOLDrrprqrrY)rr�rzr{r�r�s    @@r�"test_add_bytes_record_split_writes�6TestContainerWriter.test_add_bytes_record_split_writes�s�������[�[�+�+�
�	$�"/����-.����*����������5�5�
�K��Y���}�6�
���	
����F�#3�4����M�	
�	
���
�

�
	
rc���URR5 URRS/[S5SS/S9upUR	SX45 URS5 g)z"Add a bytes record with two names.rur1r3rm�rv�s=Bazaar pack format 1 (introduced in 0.18)
B3
name1
name2

abcNrxrys   r�test_add_bytes_record_two_names�3TestContainerWriter.test_add_bytes_record_two_names�se�����������5�5�
�H�c�&�k�+�{�)C�6�
���	
����F�#3�4����Q�	
rc���URR5 URRS/[S5S/S9upUR	SX45 URS5 g)z+Add a bytes record with a two-element name.ru�r2r4rmr�s=Bazaar pack format 1 (introduced in 0.18)
B3
name1name2

abcNrxrys   r�&test_add_bytes_record_two_element_name�:TestContainerWriter.test_add_bytes_record_two_element_name�sd�����������5�5�
�H�c�&�k�*>�)?�6�
���	
����F�#3�4����S�	
rc��URR5 URRSS/[S5/S9 URRS/[S5/S9upUR	SX45 URS5 g)N�asbcrurm)�1rws8Bazaar pack format 1 (introduced in 0.18)
B3

abcB3

abcrxrys   r�/test_add_second_bytes_record_gets_higher_offset�CTestContainerWriter.test_add_second_bytes_record_gets_higher_offset�s{�����������$�$�d�E�]�C��K�r�$�J����5�5�v�h��F��SU�5�V�������6�"2�3����L�	
rc��URR5 UR[RURR
S/[
S5S/S9 g)zSAdding a Bytes record with a name with whitespace in it raises
InvalidRecordError.
rur8rmN)rSrr9rr:rprqr
s r�"test_add_bytes_record_invalid_name�6TestContainerWriter.test_add_bytes_record_invalid_name�sO��	
����������#�#��K�K�(�(�
�H���K�!�"�	�	
rc�d�URR5 URRS/[S5/S9 UR	SURR
5 URRS/[S5/S9 UR	SURR
5 g)z=Adding a Bytes record increments the records_written counter.rlrmrorN)rSrrprqrrar
s r�-test_add_bytes_records_add_to_records_written�ATestContainerWriter.test_add_bytes_records_add_to_records_written�s������������$�$�f�X�s�6�{�"�$�E�����D�K�K�7�7�8����$�$�f�X�s�6�{�"�$�E�����D�K�K�7�7�8r)rPrS)rCrDrErFrOrYrrrbr rirrr|r�r�r�r�r�r�r�rH�
__classcell__)rTs@rrJrJJs\���>�
B�#�J�
9�
K�9�9�S�

�
�<	
�	
�
�
�9�9rrJc�r�\rSrSrSrSrSrSrSrSr	Sr
S	rS
rSr
SrS
rSrSrSrSrSrg)�TestContainerReader��z�Tests for the ContainerReader.

The ContainerReader reads format 1 containers, so these tests explicitly
test how it reacts to format 1 data.  If a new version of the format is
added, then separate tests for that format should be added.
c�H�[U5n[R"U5nU$rM)rr�ContainerReader�rr��stream�readers    r�get_reader_for�"TestContainerReader.get_reader_for�s �������%�%�f�-���
rc�0�[R"S5 g)z�Test constructing a ContainerReader.

This uses None as the output stream to show that the constructor
doesn't try to use the input stream.
N)rr�r
s rr�"TestContainerReader.test_construct�r]rc�x�URS5nUR/[UR555 g)zRead an empty container.reN)r�r�list�iter_records�rr�s  r�test_empty_container�(TestContainerReader.test_empty_container�s1���$�$�%T�U������T�&�"5�"5�"7�8�9rc�z�URS5nUR[RUR5 g)zAUnrecognised container formats raise UnknownContainerFormatError.sunknown format
N)r�r9r�UnknownContainerFormatErrorr�r�s  r�test_unknown_format�'TestContainerReader.test_unknown_format�s/���$�$�%8�9�����$�:�:�F�<O�<O�Prc��URS5nUR5nUR[R[
U5 g)zmContainers that don't end with an End Marker record should cause
UnexpectedEndOfContainerError to be raised.
rN)r�r�r9r�UnexpectedEndOfContainerError�next�rr��iterators   r� test_unexpected_end_of_container�4TestContainerReader.test_unexpected_end_of_containers;���$�$�%S�T���&�&�(�����$�<�<�d�H�Mrc��URS5nUR5nUR[R[
U5 g)z?Unknown record types cause UnknownRecordTypeError to be raised.�+Bazaar pack format 1 (introduced in 0.18)
XN)r�r�r9r�UnknownRecordTypeErrorr�r�s   r�test_unknown_record_type�,TestContainerReader.test_unknown_record_types9���$�$�%T�U���&�&�(�����$�5�5�t�X�Frc��URS5n/S4/nURUUR5VVs/sHup4X4"S54PM snn5 gs snnf)z�Read a container with one Bytes record.

Parsing Bytes records is more thoroughly exercised by
TestBytesRecordReader.  This test is here to ensure that
ContainerReader's integration with BytesRecordReader is working.
s4Bazaar pack format 1 (introduced in 0.18)
B5

aaaaaE�aaaaaN)r�rr�)rr��expected_recordsrn�
read_bytess     r�&test_container_with_one_unnamed_record�:TestContainerReader.test_container_with_one_unnamed_recordso���$�$�F�
�� ��N�+������,2�+>�+>�+@�
�+@�'�U��
�4�(�)�+@�
�	
��
s�Ac�F�URS5nUR5 g)zAValidate does not raise an error for a container with no records.reN�r��validater�s  r�test_validate_empty_container�1TestContainerReader.test_validate_empty_container!s���$�$�%T�U�����rc�F�URS5nUR5 g)zEValidate does not raise an error for a container with a valid record.s7Bazaar pack format 1 (introduced in 0.18)
B3
name

abcENr�r�s  r�'test_validate_non_empty_valid_container�;TestContainerReader.test_validate_non_empty_valid_container's!���$�$�J�
��	���rc��/SQnUHNnURU5nUR[R[R4UR
5 MP g)z�Validate raises an error for unrecognised format strings.

It may raise either UnexpectedEndOfContainerError or
UnknownContainerFormatError, depending on exactly what the string is.
)r�xs)Bazaar pack format 1 (introduced in 0.18)sbad
N)r�r9rr�r�r�)r�inputs�inputr�s    r�test_validate_bad_format�,TestContainerReader.test_validate_bad_format/sM��U���E��(�(��/�F�����3�3�T�5U�5U�V����
�rc�z�URS5nUR[RUR5 g)zFValidate raises UnknownRecordTypeError for unrecognised record
types.
r�N)r�r9rr�r�r�s  r�test_validate_bad_record_marker�3TestContainerReader.test_validate_bad_record_marker=s/���$�$�%T�U�����$�5�5�v���Grc�z�URS5nUR[RUR5 g)zcValidate raises ContainerHasExcessDataError if there are any bytes
after the end of the container.
s/Bazaar pack format 1 (introduced in 0.18)
EcrudN)r�r9r�ContainerHasExcessDataErrorr�r�s  r�#test_validate_data_after_end_marker�7TestContainerReader.test_validate_data_after_end_markerDs3���$�$�?�
��	
���$�:�:�F�O�O�Lrc�z�URS5nUR[RUR5 g)z�Validate raises UnexpectedEndOfContainerError if there's no end of
container marker, even if the container up to this point has been
valid.
rN�r�r9rr�r�r�s  r�test_validate_no_end_marker�/TestContainerReader.test_validate_no_end_markerMs/��
�$�$�%S�T�����$�<�<�f�o�o�Nrc�z�URS5nUR[RUR5 g)zbValidate raises DuplicateRecordNameError if the same name occurs
multiple times in the container.
s=Bazaar pack format 1 (introduced in 0.18)
B0
name

B0
name

EN)r�r9r�DuplicateRecordNameErrorr�r�s  r�test_validate_duplicate_name�0TestContainerReader.test_validate_duplicate_nameUs3���$�$�S�
��	
���$�7�7����Irc�z�URS5nUR[RUR5 g)�5Names that aren't valid UTF-8 cause validate to fail.s1Bazaar pack format 1 (introduced in 0.18)
B0
�

EN�r�r9rr:r�r�s  r�test_validate_undecodeable_name�3TestContainerReader.test_validate_undecodeable_name^s1���$�$�G�
��	
���$�1�1�6�?�?�CrrBN)rCrDrErFrGr�rr�r�r�r�r�r�r�r�r�r�r�r�r�rHrBrrr�r��sZ����
#�:�
Q�
N�G�
�&���H�M�O�J�Drr�c��\rSrSrSrSrSrSrSrSr	Sr
S	rS
rSr
SrS
rSrSrSrSrSrSrSrSrSrg)�TestBytesRecordReaderifaTests for reading and validating Bytes records with
BytesRecordReader.

Like TestContainerReader, this explicitly tests the reading of format 1
data.  If a new version of the format is added, then a separate set of
tests for reading that format should be added.
c�H�[U5n[R"U5nU$rM)rr�BytesRecordReaderr�s    rr��$TestBytesRecordReader.get_reader_foros �������'�'��/���
rc��URS5nUR5up#UR/U5 URSU"S55 g)�DReading a Bytes record with no name returns an empty list of
names.
�5

aaaaar�N�r��readr�rr�rn�	get_bytess    r�test_record_with_no_name�.TestBytesRecordReader.test_record_with_no_nametsF���$�$�]�3��!�;�;�=�������U�#�����9�T�?�3rc��URS5nUR5up#URS/U5 URSU"S55 g)�GReading a Bytes record with one name returns a list of just that
name.
�5
name1

aaaaar1r�Nr�r�s    r�test_record_with_one_name�/TestBytesRecordReader.test_record_with_one_name}sI���$�$�%9�:��!�;�;�=������+���.�����9�T�?�3rc��URS5nUR5up#URSS/U5 URSU"S55 g)�CReading a Bytes record with two names returns a list of both names.�5
name1
name2

aaaaar1r3r�Nr�r�s    r�test_record_with_two_names�0TestBytesRecordReader.test_record_with_two_names�sJ���$�$�%@�A��!�;�;�=������+�{�3�U�;�����9�T�?�3rc��URS5nUR5up#URS/U5 URSU"S55 g)�7Reading a Bytes record with a two_part name reads both.�5
name1name2

aaaaar�r�Nr�r�s    r�test_record_with_two_part_names�5TestBytesRecordReader.test_record_with_two_part_names�sT���$�$�%B�C��!�;�;�=�������
�
�	
�	
����9�T�?�3rc�z�URS5nUR[RUR5 g�zIIf the length-prefix is not a number, parsing raises
InvalidRecordError.
s
not a number
N�r�r9rr:r�r�s  r�test_invalid_length�)TestBytesRecordReader.test_invalid_length�s/���$�$�%6�7�����$�1�1�6�;�;�?rc��Sn[S[U55HTnUSUnURU5nUR5upVU"S5 UR	SRU55 MV g![Ra Mpf=f)aETests for premature EOF occuring during parsing Bytes records with
BytesRecordReader.

A incomplete container might be interrupted at any point.  The
BytesRecordReader needs to cope with the input stream running out no
matter where it is in the parsing process.

In all cases, UnexpectedEndOfContainerError should be raised.
s6
name

abcdefrNz:UnexpectedEndOfContainerError not raised when parsing {!r})�rangerqr�r��fail�formatrr�)r�complete_record�count�incomplete_recordr�rnr�s       r�test_early_eof�$TestBytesRecordReader.test_early_eof�s���/���1�c�/�2�3�E� /��� 7���(�(�):�;�F�

�$*�K�K�M�!���4� ��	�	�P�W�W�)���4���5�5�
��
�s�A1�1B	�B	c�z�URS5nUR[RUR5 g)z!EOF before any bytes read at all.rN�r�r9rr�r�r�s  r�test_initial_eof�&TestBytesRecordReader.test_initial_eof�s,���$�$�S�)�����$�<�<�f�k�k�Jrc�z�URS5nUR[RUR5 g)z8EOF after reading the length and before reading name(s).s123
Nrr�s  r�test_eof_after_length�+TestBytesRecordReader.test_eof_after_length�s,���$�$�X�.�����$�<�<�f�k�k�Jrc�z�URS5nUR[RUR5 g)zEOF during reading a name.s123
nameNrr�s  r�test_eof_during_name�*TestBytesRecordReader.test_eof_during_name�s,���$�$�\�2�����$�<�<�f�k�k�Jrc�f�URS5nUR[RUR5 URS5nUR[RUR5 URS5nUR[RUR5 g��Names must have no whitespace.�0
bad name

s0
bad	name

s0
badname

Nrr�s  r�!test_read_invalid_name_whitespace�7TestBytesRecordReader.test_read_invalid_name_whitespace�s����$�$�%7�8�����$�1�1�6�;�;�?��$�$�%8�9�����$�1�1�6�;�;�?��$�$�%8�9�����$�1�1�6�;�;�?rc�z�URS5nUR[RUR5 g)r&r'Nr�r�s  r� test_validate_whitespace_in_name�6TestBytesRecordReader.test_validate_whitespace_in_name�s-���$�$�%7�8�����$�1�1�6�?�?�Crc�z�URS5nUR[RUR5 g)z>EOF during reading a record's prelude causes validate to fail.rNr�r�s  r�!test_validate_interrupted_prelude�7TestBytesRecordReader.test_validate_interrupted_prelude�s,���$�$�S�)�����$�<�<�f�o�o�Nrc�z�URS5nUR[RUR5 g)z;EOF during reading a record's body causes validate to fail.s1

Nr�r�s  r�test_validate_interrupted_body�4TestBytesRecordReader.test_validate_interrupted_body�s,���$�$�X�.�����$�<�<�f�o�o�Nrc�z�URS5nUR[RUR5 g)z5An unparseable record length causes validate to fail.s

Nr�r�s  r� test_validate_unparseable_length�6TestBytesRecordReader.test_validate_unparseable_length�s,���$�$�W�-�����$�1�1�6�?�?�Crc�z�URS5nUR[RUR5 g)r�s0
�

Nr�r�s  rr��5TestBytesRecordReader.test_validate_undecodeable_name�s,���$�$�^�4�����$�1�1�6�?�?�Crc�z�URS5nUR5up#URSU"S55 g)zwIf the max_length passed to the callable returned by read is not
None, then no more than that many bytes will be read.
�	6

abcdefrurNr�r�s    r�test_read_max_length�*TestBytesRecordReader.test_read_max_length�s6���$�$�^�4��!�;�;�=��������1��.rc�z�URS5nUR5up#URSU"S55 g)zrIf the max_length passed to the callable returned by read is None,
then all the bytes in the record will be read.
r9�abcdefNr�r�s    r�test_read_no_max_length�-TestBytesRecordReader.test_read_no_max_length�s6���$�$�^�4��!�;�;�=�������I�d�O�4rc���URS5nUR5up#URSU"S55 URSU"S55 URSU"S55 g)zpRepeated calls to the callable returned from BytesRecordReader.read
will not read beyond the end of the record.
s6

abcdefB3
next-record
XXXr=Nr�cr�r�s    r�test_repeated_read_calls�.TestBytesRecordReader.test_repeated_read_callss_���$�$�%G�H��!�;�;�=�������I�d�O�4�����i��o�.�����i��m�,rrBN)rCrDrErFrGr�r�rrr
rrrrr"r(r+r.r1r4r�r:r>rBrHrBrrr�r�fsp����
4�4�4�
4�@��8K�
K�
K�
@�D�
O�
O�
D�
D�
/�5�-rr�c��\rSrSrSrSrg)�TestMakeReadvReaderic���[5n[R"UR5nUR	5 /nURUR
S/S/S95 URUR
S/SS/S95 URUR
S/SS/S95 URUR
S/S/S95 UR5 UR5nURS	UR55 US
US/n[R"US	U5n/nUR5Hup�URX�"S545 M UR/S4S/S4/U5 g)Nrurrmsdefr1sghir3sjkl�mypackrr)rrrQrRrr�rpr�
get_transport�	put_bytesrW�make_readv_readerr�r)
r�	pack_datarS�memos�	transport�requested_recordsr��resultrn�reader_funcs
          r�test_read_skipping_records�.TestMakeReadvReader.test_read_skipping_recordssX���I�	��%�%�i�o�o�6��������
���V�,�,�f�X�q��,�C�D�
���V�,�,�f�X�q��
�,�N�O�
���V�,�,�f�X�q��
�,�N�O�
���V�,�,�f�X�q��,�C�D��
�
���&�&�(�	����H�i�&8�&8�&:�;�"�1�X�u�Q�x�0���'�'�	�8�=N�O����"(�"5�"5�"7��E��M�M�5�+�d�"3�4�5�#8����2�v�,�+���(?�@�&�IrrBN)rCrDrErFrQrHrBrrrErEs��JrrEc�*�\rSrSrSrSrSrSrSrg)�
TestReadvFilei%z�Tests of the ReadVFile class.

Error cases are deliberately undefined: this code adapts the underlying
transport interface to a single 'streaming read' interface as
ContainerReader needs.
c��UR5nURSS5 [R"UR	S/SQ55n/nURUR
S55 URUR
S55 URUR
S55 URUR
S55 URUR
S55 UR/SQU5 g)z:Test reading of both single bytes and all bytes in a hunk.�samples
0123456789))rro)ror)�ro)�rror)�0s12�4�6�7N)rHrIr�	ReadVFile�readvr�r�r�rrM�f�resultss    r�test_read_bytes�TestReadvFile.test_read_bytes-s����&�&�(�	����H�m�4��N�N�9�?�?�8�5U�V�W�������q�v�v�a�y�!����q�v�v�a�y�!����q�v�v�a�y�!����q�v�v�a�y�!����q�v�v�a�y�!����8�'�Brc�~�UR5nURSS5 [R"UR	SSS/55n/nURUR
55 URUR
55 URUR
55 UR/SQU5 g)zeTest using readline() as ContainerReader does.

This is always within a readv hunk, never across it.
rV�0
2
4
)rr)rrW)s0
s2
s4
N)rHrIrr]r^r��readlinerr_s    r�
test_readline�TestReadvFile.test_readline:s���
�&�&�(�	����H�l�3��N�N�9�?�?�8�f�f�5E�F�G�������q�z�z�|�$����q�z�z�|�$����q�z�z�|�$����1�7�;rc��UR5nURSS5 [R"UR	SS/55n/nURUR
S55 URUR55 URUR
S55 UR/SQU5 g)z>Test exercising one byte reads, readline, and then read again.rVre)rrXrorW)rY�
s2
4
N)	rHrIrr]r^r�r�rfrr_s    r�test_readline_and_read�$TestReadvFile.test_readline_and_readHs����&�&�(�	����H�l�3��N�N�9�?�?�8�f�X�>�?�������q�v�v�a�y�!����q�z�z�|�$����q�v�v�a�y�!����1�7�;rrBN)	rCrDrErFrGrbrgrkrHrBrrrTrT%s���C�<�	<rrTc�*�\rSrSrSrSrSrSrSrg)�PushParserTestCaseiTz7Base class for TestCases involving ContainerPushParser.c�R�[R"5nURS5 U$r�r�ContainerPushParser�accept_bytes�r�parsers  r�!make_parser_expecting_record_type�4PushParserTestCase.make_parser_expecting_record_typeWs$���)�)�+�����J�K��
rc�R�[R"5nURS5 U$)Ns+Bazaar pack format 1 (introduced in 0.18)
Brprss  r�"make_parser_expecting_bytes_record�5PushParserTestCase.make_parser_expecting_bytes_record\s$���)�)�+�����K�L��
rc��UR5nURU5 UR5nURU/U5 g)zkAssert that 'bytes' is parsed as a given bytes record.

:param expected_record: A tuple of (names, bytes).
N)rxrr�read_pending_recordsr)r�expected_recordr�rt�parsed_recordss     r�assertRecordParsing�&PushParserTestCase.assertRecordParsingasA��
�8�8�:�����D�!��4�4�6�����/�*�N�;rrBN)	rCrDrErFrGrurxr~rHrBrrrnrnTs��A��
�
<rrnc�*�\rSrSrSrSrSrSrSrg)�TestContainerPushParserilz�Tests for ContainerPushParser.

The ContainerPushParser reads format 1 containers, so these tests
explicitly test how it reacts to format 1 data.  If a new version of the
format is added, then separate tests for that format should be added.
c�.�[R"5 g)z'ContainerPushParser can be constructed.N)rrqr
s rr�&TestContainerPushParser.test_constructtrrc��UR5nURS5 URS/S4S/S4/UR55 g)z�If multiple records worth of data are fed to the parser in one
string, the parser will correctly parse all the records.

(A naive implementation might stop after parsing the first record.)
sB5
name1

body1B5
name2

body2r1sbody1r3sbody2N�rurrrr{rss  r�test_multiple_records_at_once�5TestContainerPushParser.test_multiple_records_at_oncexsQ���7�7�9�����C�D�����m�X�
&�+���(A�B��'�'�)�	
rc��UR5nURS5 URS/S4S/S4/UR55 g)z�If multiple empty records worth of data are fed to the parser in one
string, the parser will correctly parse all the records.

(A naive implementation might stop after parsing the first empty
record, because the buffer size had not changed.)
sB0
name1

B0
name2

r1rr3Nr�rss  r�#test_multiple_empty_records_at_once�;TestContainerPushParser.test_multiple_empty_records_at_once�sP���7�7�9�����9�:�����m�S�
!�[�M�3�#7�8�&�:U�:U�:W�	
rrBN)	rCrDrErFrGrr�r�rHrBrrr�r�ls���#�
�
rr�c�T�\rSrSrSrSrSrSrSrSr	Sr
S	rS
rSr
SrS
rg)�#TestContainerPushParserBytesParsingi�aTests for reading Bytes records with ContainerPushParser.

The ContainerPushParser reads format 1 containers, so these tests
explicitly test how it reacts to format 1 data.  If a new version of the
format is added, then separate tests for that format should be added.
c�,�UR/S4S5 g)r�r�r�N�r~r
s rr��<TestContainerPushParserBytesParsing.test_record_with_no_name�s��	
� � �"�h���?rc�.�URS/S4S5 g)r�r1r�r�Nr�r
s rr�=TestContainerPushParserBytesParsing.test_record_with_one_name�s��	
� � �;�-��!:�<P�Qrc�0�URSS/S4S5 g)rr1r3r�rNr�r
s rr�>TestContainerPushParserBytesParsing.test_record_with_two_names�s ��� � ��;�
'��2�4O�	
rc�.�URS/S4S5 g)rr�r�r	Nr�r
s rr
�CTestContainerPushParserBytesParsing.test_record_with_two_part_names�s��� � �"�
#�X�.�0M�	
rc�z�UR5nUR[RURS5 gr
�rxr9rr:rrrss  rr�7TestContainerPushParserBytesParsing.test_invalid_length�s4���8�8�:������#�#�V�%8�%8�:K�	
rc��UR5nURS5 UR/UR55 g)ztIf the bytes seen so far don't form a complete record, then there
will be nothing returned by read_pending_records.
s5

abcdN�rxrrrr{rss  r�test_incomplete_record�:TestContainerPushParserBytesParsing.test_incomplete_record�s9���8�8�:�����L�)�����V�8�8�:�;rc�F�UR5nURS5 g)z9The edge case of parsing an empty string causes no error.rN)rxrrrss  r�test_accept_nothing�7TestContainerPushParserBytesParsing.test_accept_nothing�s���8�8�:�����C� rc�z�UR5nUR[RURU5 g)z>Assert that parsing the given bytes raises InvalidRecordError.Nr�)rr�rts   r�assertInvalidRecord�7TestContainerPushParserBytesParsing.assertInvalidRecord�s.���8�8�:�����$�1�1�6�3F�3F��Mrc�j�URS5 URS5 URS5 gr%)r�r
s rr(�ETestContainerPushParserBytesParsing.test_read_invalid_name_whitespace�s5��	
� � �!3�4�	
� � �!4�5�	
� � �!4�5rc���UR5nURS5 UR/S4/UR55 UR/UR55 g)z;read_pending_records will not return the same record twice.r9r=Nr�rss  r�"test_repeated_read_pending_records�FTestContainerPushParserBytesParsing.test_repeated_read_pending_records�sW���8�8�:�����N�+����2�y�/�*�F�,G�,G�,I�J�����V�8�8�:�;rrBN)rCrDrErFrGr�rrr
rr�r�r�r(r�rHrBrrr�r��s<���@�R�
�
�
�<�!�
N�
	6�<rr�c�8�\rSrSrSrSrSrSrSrSr	Sr
g	)
�
TestErrorsi�c�f�[R"S5nURS[U55 g)z3Test the formatting of UnknownContainerFormatError.zbad format stringz2Unrecognised container format: 'bad format string'N)rr�r�str�r�es  r�test_unknown_container_format�(TestErrors.test_unknown_container_format�s)���,�,�-@�A�����M�s�ST�v�Vrc�d�[R"5nURS[U55 g)z5Test the formatting of UnexpectedEndOfContainerError.z"Unexpected end of container streamN)rr�rr�r�s  rr��+TestErrors.test_unexpected_end_of_container�s%���.�.�0�����=�s�1�v�Frc�f�[R"S5nURS[U55 g)z.Test the formatting of UnknownRecordTypeError.�XzUnknown record type: 'X'N)rr�rr�r�s  rr��#TestErrors.test_unknown_record_type�s'���'�'��,�����3�S��V�<rc�f�[R"S5nURS[U55 g)z*Test the formatting of InvalidRecordError.�xxxzInvalid record: xxxN)rr:rr�r�s  r�test_invalid_record�TestErrors.test_invalid_record�s'���#�#�E�*�����.��A��7rc�f�[R"S5nURS[U55 g)z3Test the formatting of ContainerHasExcessDataError.zexcess bytesz3Container has data after end marker: 'excess bytes'N)rr�rr�r�s  r�test_container_has_excess_data�)TestErrors.test_container_has_excess_data�s*���,�,�^�<�����N�PS�TU�PV�Wrc�f�[R"S5nURS[U55 g)z0Test the formatting of DuplicateRecordNameError.snåmeu8Container has multiple records with the same name: nåmeN)rr�rr�r�s  r� test_duplicate_record_name_error�+TestErrors.test_duplicate_record_name_error�s)���)�)�.�9�����H�#�a�&�	
rrBN)rCrDrErFr�r�r�r�r�r�rHrBrrr�r��s#��W�
G�
=�
8�
X�

rr�N)rG�ior�rr�TestCaser	rJr�r��TestCaseWithTransportrErTrnr�r�r�rBrr�<module>r�s���"����.;�e�n�n�.;�bT9�%�.�.�T9�nBD�%�.�.�BD�Jg-�E�N�N�g-�TJ�%�5�5�J�*,<�E�/�/�,<�^<����<�0$
�0�$
�NK<�*<�K<�\
����
r

Youez - 2016 - github.com/yon3zu
LinuXploit