HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/incremental/tests/__pycache__/test_version.cpython-38.pyc
U

7�^�Q�@s�dZddlmZmZddlZddlZddlZddlmZddl	m
Z
ddlmZm
Z
ddlmZmZddlmZdd	lmZd
ZdZdZd
ZGdd�de�ZGdd�de�ZdS)z
Tests for L{incremental}.
�)�division�absolute_importN)�mkdtemp)�BytesIO)�getVersionString�IncomparableVersions)�Version�_inf)�FilePath)�TestCases�<?xml version="1.0" encoding="utf-8"?>
<wc-entries
   xmlns="svn:">
<entry
   committed-rev="18210"
   name=""
   committed-date="2006-09-21T04:43:09.542953Z"
   url="svn+ssh://svn.twistedmatrix.com/svn/Twisted/trunk/twisted"
   last-author="exarkun"
   kind="dir"
   uuid="bbbe8e31-12d6-0310-92fd-ac37d47ddeeb"
   repos="svn+ssh://svn.twistedmatrix.com/svn/Twisted"
   revision="18211"/>
</wc-entries>
s?8

dir
22715
svn+ssh://svn.twistedmatrix.com/svn/Twisted/trunk
s?9

dir
22715
svn+ssh://svn.twistedmatrix.com/svn/Twisted/trunk
s@10

dir
22715
svn+ssh://svn.twistedmatrix.com/svn/Twisted/trunk
c@s|eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*dQdR�Z+dSdT�Z,dUdV�Z-dWdX�Z.dYdZ�Z/d[d\�Z0d]S)^�
VersionsTestscCs,tddddddd�}|�|��|���dS)zE
        The local version is the same as the short version.
        �dummy�r���release_candidate�devN)r�assertEqualZlocal�short)�self�va�r�@/usr/lib/python3/dist-packages/incremental/tests/test_version.py�test_localIsShortDszVersionsTests.test_localIsShortcCs�tdddd�}tdddd�}|�||k�|�||k�|�||k�|�||k�|�||k�|�|tdddd�k�|�||k�dS)zB
        Versions can be compared for equality and order.
        r
rrN�r�
assertTrue�rrZvbrrr�test_versionComparisonKsz$VersionsTests.test_versionComparisoncCs�tdddd�}tdddd�}|�||k�|�||k�|�||k�|�||k�|�||k�|�|tdddd�k�|�||k�dS)z=
        Version package names are case insensitive.
        r
rrZDuMmYNrrrrr�%test_versionComparisonCaseInsensitiveYsz3VersionsTests.test_versionComparisonCaseInsensitivecCsHtdddd�}tdddd�}|�||k�|�||k�|�||�dS)zI
        NEXT releases are always larger than numbered releases.
        �whatever�NEXTrrN�rr�assertFalseZassertNotEqualsrrrr�test_comparingNEXTReleasesgs
z(VersionsTests.test_comparingNEXTReleasesc	Cs�|�t��tddddddd�W5QRX|�t��tddddddd�W5QRX|�t��tddddddd�W5QRX|�t��tddddddd�W5QRXdS)zR
        NEXT releases must always have the rest of the numbers set to 0.
        rr rrrN��assertRaises�
ValueErrorr�rrrr�test_NEXTMustBeAloneqsz"VersionsTests.test_NEXTMustBeAlonecCs,tdddd�}tdddd�}|�||�dS)z8
        NEXT releases are equal to each other.
        rr rN)rZassertEqualsrrrr�test_comparingNEXTReleasesEqual�sz-VersionsTests.test_comparingNEXTReleasesEqualcCsLtdddddd�}tdddd�}|�||k�|�||k�|�||�dS)zP
        Prereleases are always less than versions without prereleases.
        rrr��
prereleaseNr!rrrr�%test_comparingPrereleasesWithReleases�s
z3VersionsTests.test_comparingPrereleasesWithReleasescCsBtdddddd�|��}|�t|�d�|�|ddd�dS)z@
        Passing 'prerelease' to Version is deprecated.
        rrrr*�messagezvPassing prerelease to incremental.Version was deprecated in Incremental 16.9.0. Please pass release_candidate instead.N)r�
flushWarningsr�len)r�warningsrrr�test_prereleaseDeprecated�s
�z'VersionsTests.test_prereleaseDeprecatedcCsHtdddddd�}|j|��}|�t|�d�|�|ddd�dS)zD
        Accessing 'prerelease' on a Version is deprecated.
        rrr�rr-zuAccessing incremental.Version.prerelease was deprecated in Incremental 16.9.0. Use Version.release_candidate instead.N)rr+r.rr/)rrr0rrr�"test_prereleaseAttributeDeprecated�s
�z0VersionsTests.test_prereleaseAttributeDeprecatedcCsLtdddddd�}tdddd�}|�||k�|�||k�|�||�dS)zf
        Release Candidates are always less than versions without release
        candidates.
        rrrr2Nr!rrrr�+test_comparingReleaseCandidatesWithReleases�s
z9VersionsTests.test_comparingReleaseCandidatesWithReleasescCsLtdddddd�}tdddd�}|�||k�|�||k�|�||�dS)zR
        Dev releases are always less than versions without dev releases.
        rrr�rNr!rrrr�%test_comparingDevReleasesWithReleases�s
z3VersionsTests.test_comparingDevReleasesWithReleasescCsDtdddddd�}tdddddd�}|�||k�|�||k�dS)z>
        Release Candidates are equal to prereleases.
        rrrr2r*N)rrr"rrrr�test_rcEqualspre�szVersionsTests.test_rcEqualsprec	Cs.|�t��tddddddd�W5QRXdS)zG
        Release Candidate and prerelease can't both be given.
        rrr)r+rNr$r'rrr�test_rcOrpreButNotBoth�s

�z$VersionsTests.test_rcOrpreButNotBothc
Cs�tdddddd�}tdddddd�}|�||k�|�||k�|�||k�|�||k�|�||k�|�|tdddddd�k�|�||k�dS)zf
        The value specified as the release candidate is used in version
        comparisons.
        rrrr2�Nrrrrr�test_comparingReleaseCandidates�s�
z-VersionsTests.test_comparingReleaseCandidatesc
Cs�tdddddd�}tdddddd�}|�||k�|�||k�|�||k�|�||k�|�||k�|�|tdddddd�k�|�||k�dS)zX
        The value specified as the dev release is used in version comparisons.
        rrrr5r9Nrrrrr�test_comparingDev�s�
zVersionsTests.test_comparingDevcCs�tddddddd�}tddddddd�}|�||k�|�||k�|�||k�|�||k�|�||k�|�|tddddddd�k�|�||k�dS�zv
        The value specified as the dev release and release candidate is used in
        version comparisons.
        rrrrr9Nrrrrr�test_comparingDevAndRC�s�
z$VersionsTests.test_comparingDevAndRCcCs�tddddddd�}tddddddd�}|�||k�|�||k�|�||k�|�||k�|�||k�|�|tddddddd�k�|�||k�dSr<rrrrr�test_comparingDevAndRCDifferents�
z-VersionsTests.test_comparingDevAndRCDifferentcCs|�tt�dS)zR
        L{_inf} is equal to L{_inf}.

        This is a regression test.
        N)rr	r'rrr�test_infComparisonsz VersionsTests.test_infComparisonc
Cs*|�ttjtdddd�tdddd��dS)zO
        The package names of the Version objects need to be the same.
        r
rrZdumymN)r%r�operator�eqrr'rrr�test_disallowBuggyComparisonss
�z+VersionsTests.test_disallowBuggyComparisonscCs(tdddd�}d}|�|�|�t�dS)zh
        Comparing a L{Version} to some other object type results in
        C{NotImplemented}.
        r
rr)r
rrrN)rrZ__cmp__�NotImplementedrrrr�test_notImplementedComparisons"sz,VersionsTests.test_notImplementedComparisonscCs|�ttdddd��d�dS)zu
        Calling C{repr} on a version returns a human-readable string
        representation of the version.
        r
rr9rzVersion('dummy', 1, 2, 3)N�r�reprrr'rrr�	test_repr+s�zVersionsTests.test_reprc
Cs"|�ttdddddd��d�dS)	z�
        Calling C{repr} on a version with a prerelease returns a human-readable
        string representation of the version including the prerelease as a
        release candidate..
        r
rr9r�r*�.Version('dummy', 1, 2, 3, release_candidate=4)NrEr'rrr�test_reprWithPrerelease3s�z%VersionsTests.test_reprWithPrereleasec
Cs"|�ttdddddd��d�dS)	z�
        Calling C{repr} on a version with a release candidate returns a
        human-readable string representation of the version including the rc.
        r
rr9rrHr2rINrEr'rrr�test_reprWithReleaseCandidate<s�z+VersionsTests.test_reprWithReleaseCandidatec
Cs"|�ttdddddd��d�dS)	z�
        Calling C{repr} on a version with a dev release returns a
        human-readable string representation of the version including the dev
        release.
        r
rr9rrHr5z Version('dummy', 1, 2, 3, dev=4)NrEr'rrr�test_devWithReleaseCandidateDs�z*VersionsTests.test_devWithReleaseCandidatecCs|�ttdddd��d�dS)zt
        Calling C{str} on a version returns a human-readable string
        representation of the version.
        r
rr9rz[dummy, version 1.2.3]N�r�strrr'rrr�test_strMs�zVersionsTests.test_strc
Cs"|�ttdddddd��d�dS)zw
        Calling C{str} on a version with a prerelease includes the prerelease
        as a release candidate.
        r
rrr*�[dummy, version 1.0.0rc1]NrMr'rrr�test_strWithPrereleaseUs�z$VersionsTests.test_strWithPrereleasec
Cs"|�ttdddddd��d�dS)zn
        Calling C{str} on a version with a release candidate includes the
        release candidate.
        r
rrr2rPNrMr'rrr�test_strWithReleaseCandidate]s�z*VersionsTests.test_strWithReleaseCandidatecCs$|�ttddddddd��d�dS)z�
        Calling C{str} on a version with a release candidate and dev release
        includes the release candidate and the dev release.
        r
rrr9rz[dummy, version 1.0.0rc1dev2]NrMr'rrr�"test_strWithDevAndReleaseCandidatees��z0VersionsTests.test_strWithDevAndReleaseCandidatec
Cs"|�ttdddddd��d�dS)zb
        Calling C{str} on a version with a dev release includes the dev
        release.
        r
rrr5z[dummy, version 1.0.0dev1]NrMr'rrr�test_strWithDevns�zVersionsTests.test_strWithDevcCs|�tdddd���d�dS)Nr
rr9rz1.2.3)rrrr'rrr�	testShortvszVersionsTests.testShortcCs(tdddd�}|�|�tt��d�dS)zO
        Version should be able to parse an SVN format 4 entries file.
        r
rr�18211N)rrZ_parseSVNEntries_4r�VERSION_4_ENTRIES�r�versionrrr�test_goodSVNEntries_4ys
�z#VersionsTests.test_goodSVNEntries_4cCs(tdddd�}|�|�tt��d�dS)zO
        Version should be able to parse an SVN format 8 entries file.
        r
rr�22715N)rrZ_parseSVNEntries_8r�VERSION_8_ENTRIESrXrrr�test_goodSVNEntries_8�s
�z#VersionsTests.test_goodSVNEntries_8cCs(tdddd�}|�|�tt��d�dS)zO
        Version should be able to parse an SVN format 9 entries file.
        r
rrr[N)rrZ_parseSVNEntries_9r�VERSION_9_ENTRIESrXrrr�test_goodSVNEntries_9�s
�z#VersionsTests.test_goodSVNEntries_9cCs(tdddd�}|�|�tt��d�dS)zP
        Version should be able to parse an SVN format 10 entries file.
        r
rrr[N)rrZ_parseSVNEntriesTenPlusr�VERSION_10_ENTRIESrXrrr�test_goodSVNEntriesTenPlus�s
�z(VersionsTests.test_goodSVNEntriesTenPlusc	Cs|�dttdddd���dS)zr
        L{getVersionString} returns a string with the package name and the
        short version number.
        z
Twisted 8.0.0ZTwisted�rN�rrrr'rrr�test_getVersionString�s�z#VersionsTests.test_getVersionStringc
Cs"|�ttdddddd��d�dS)ze
        L{getVersionString} includes the prerelease as a release candidate, if
        any.
        rrbrrr*�whatever 8.0.0rc1Nrcr'rrr�#test_getVersionStringWithPrerelease�s�z1VersionsTests.test_getVersionStringWithPrereleasec
Cs"|�ttdddddd��d�dS)zM
        L{getVersionString} includes the release candidate, if any.
        rrbrrr2reNrcr'rrr�)test_getVersionStringWithReleaseCandidate�s��z7VersionsTests.test_getVersionStringWithReleaseCandidatec
Cs"|�ttdddddd��d�dS)zG
        L{getVersionString} includes the dev release, if any.
        rrbrrr5zwhatever 8.0.0dev1Nrcr'rrr�test_getVersionStringWithDev�s��z*VersionsTests.test_getVersionStringWithDevcCs$|�ttddddddd��d�dS)	ze
        L{getVersionString} includes the dev release and release candidate, if
        any.
        rrbrr9rrzwhatever 8.0.0rc2dev1Nrcr'rrr�!test_getVersionStringWithDevAndRC�s��z/VersionsTests.test_getVersionStringWithDevAndRCcCs|�tdddd���d�dS)zX
        The C{base} method returns just "NEXT" when NEXT is the major version.
        �foor rN�rr�baser'rrr�test_baseWithNEXT�szVersionsTests.test_baseWithNEXTcCs|�tdddd���d�dS)zY
        The C{base} method returns a very simple representation of the version.
        rjrrz1.0.0Nrkr'rrr�	test_base�szVersionsTests.test_basec	Cs"|�tdddddd���d�dS)�P
        The base version includes 'rcX' for versions with prereleases.
        rjrrrbr*�1.0.0rc8Nrkr'rrr�test_baseWithPrerelease�s�z%VersionsTests.test_baseWithPrereleasec	Cs"|�tdddddd���d�dS)zR
        The base version includes 'devX' for versions with dev releases.
        rjrrrbr5z	1.0.0dev8Nrkr'rrr�test_baseWithDev�s�zVersionsTests.test_baseWithDevc	Cs"|�tdddddd���d�dS)rorjrrrbr2rpNrkr'rrr�test_baseWithReleaseCandidate�s�z+VersionsTests.test_baseWithReleaseCandidatec
Cs$|�tddddddd���d�dS)	zu
        The base version includes 'rcXdevX' for versions with dev releases and
        a release candidate.
        rjrrr9rbrz1.0.0rc2dev8Nrkr'rrr�test_baseWithDevAndRC�s��z#VersionsTests.test_baseWithDevAndRCcCsrt|���}|��|�d��d�|�d��d�}|��|�d��d�tddd	d	�}|�|�|j�d
�dS)NZHEADsref: refs/heads/master
Zrefs�headsZmasters)a96d61d94949c0dc097d6e1c3515792e99a724d5
rjrrZ(a96d61d94949c0dc097d6e1c3515792e99a724d5)	r
Zmktemp�makedirs�child�
setContentrrZ_parseGitDir�path)rZgitDirrurYrrr�test_git�s
��zVersionsTests.test_gitN)1�__name__�
__module__�__qualname__rrrr#r(r)r,r1r3r4r6r7r8r:r;r=r>r?rBrDrGrJrKrLrOrQrRrSrTrUrZr]r_rardrfrgrhrirmrnrqrrrsrtrzrrrrrBs\



										
	rc@sheZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZdS)�FormatDiscoveryTestszT
    Tests which discover the parsing method based on the imported module name.
    cCsttt��|_|�|jj�tj��|_tj	�
|jj	�|j�d�}|��|�d��
d�|�d�|_|j��dS)zN
        Create a temporary directory with a package structure in it.
        �incremental_test_packagez__init__.pysWfrom incremental import Version
version = Version('incremental_test_package', 1, 0, 0)
z.svnN)r
r�entryZ
addCleanup�remove�sys�modules�copy�preTestModulesry�appendrwrvrx�
svnEntries)r�pkgrrr�setUps
�zFormatDiscoveryTests.setUpcCs,tj��tj�|j�tj�|jj�dS)zI
        Remove the imported modules and sys.path modifications.
        N)r�r��clear�updater�ryr�r�r'rrr�tearDowns
zFormatDiscoveryTests.tearDowncCs@|j�d��|d�|j�d��|�|�|����|�dS)z�
        Check for the given revision being detected after setting the SVN
        entries text and format version of the test directory structure.
        �format�
�entriesN)r�rwrxr�
getVersion�_getSVNVersion)rZ
formatVersionZentriesTextZexpectedRevisionrrr�checkSVNFormatsz#FormatDiscoveryTests.checkSVNFormatcCsddl}|jS)zf
        Import and retrieve the Version object from our dynamically created
        package.
        rN)rrY)rrrrrr�'szFormatDiscoveryTests.getVersioncCs|�dtd�dS)zY
        Verify that version 4 format file will be properly detected and parsed.
        �4rVN)r�rWr'rrr�test_detectVersion4/sz(FormatDiscoveryTests.test_detectVersion4cCs|�dtd�dS)zb
        Verify that version 8 format files will be properly detected and
        parsed.
        �8r[N)r�r\r'rrr�test_detectVersion85sz(FormatDiscoveryTests.test_detectVersion8cCs|�dtd�dS)zb
        Verify that version 9 format files will be properly detected and
        parsed.
        �9r[N)r�r^r'rrr�test_detectVersion9<sz(FormatDiscoveryTests.test_detectVersion9cCs|�ddd�dS)z�
        Verify that the result is C{b"Unknown"} for an apparently supported
        version for which parsing of the entries file fails.
        r�ssome unsupported stuff�UnknownN�r�r'rrr�test_unparseableEntriesCsz,FormatDiscoveryTests.test_unparseableEntriescCs*|j�d��t�|�|����d�dS)a
        Verify that version 10 format files will be properly detected and
        parsed.

        Differing from previous formats, the version 10 format lacks a
        I{format} file and B{only} has the version information on the first
        line of the I{entries} file.
        r�r[N)r�rwrxr`rr�r�r'rrr�test_detectVersion10Js	z)FormatDiscoveryTests.test_detectVersion10cCs|�ddd�dS)zY
        Verify that a new version of SVN will result in the revision 'Unknown'.
        ssome-random-new-versionsooga booga!r�Nr�r'rrr�test_detectUnknownVersionVs�z.FormatDiscoveryTests.test_detectUnknownVersioncCsT|j�d��d�|j�d��t�t|���}|�d|�|�t|t	d���dS)zN
        L{getVersionString} includes the discovered revision number.
        r�s9
r�z%incremental_test_package 1.0.0+r22715�N)
r�rwrxr`rr�rr�
isinstance�typerXrrr�!test_getVersionStringWithRevision]s�z6FormatDiscoveryTests.test_getVersionStringWithRevisionN)r{r|r}�__doc__r�r�r�r�r�r�r�r�r�r�r�rrrrr~s	r~)r�Z
__future__rrr�r@ZunittestZtempfiler�iorZincrementalrrrr	Ztwisted.python.filepathr
Ztwisted.trial.unittestrrWr\r^r`rr~rrrr�<module>s&	B