+
    Hwi                     d    R t ^ RIt^ RIHtHtHt ^ RIHt ^ RIH	t	 ^ RI
HtHt  ! R R]	4      tR# )z1Test handling of ``pyproject.toml`` configurationN)castOptionalUnion)Path)TestCase)_load_pyproject_toml_IncrementalConfigc                   t   a  ] tR t^t o RtRR/V 3R lR lltR tR tR tR	 t	R
 t
R tR tR tR tRtV tR# )VerifyPyprojectDotTomlTestsz/Test the `_load_pyproject_toml` helper functionpathNc                T   < V ^8  d   QhRS[ RS[S[S[ R3,          RS[S[,          /# )   tomlr   Nreturn)strr   r   r   r   )format__classdict__s   "B/usr/lib/python3/dist-packages/incremental/tests/test_pyproject.py__annotate__(VerifyPyprojectDotTomlTests.__annotate__   s6      "'c4"8	$	%    c               P   Vf   V P                  4       pM\        V4      p\        VR4      ;_uu_ 4       pVP                  V4       RRR4        \	        V4      #   + '       g   i     L; i  \
         d-   p\        TR4      '       d   TP                  RT 24       h Rp?ii ; i)z
Read a TOML snipped from a temporary file with `_load_pyproject_toml`

@param toml: TOML content of the temporary file

@param path: Path to which the TOML is written
Nwadd_notezWhile loading:

)mktempr   openwriter   	Exceptionhasattrr   )selfr   r   path_fes   &&$   r   	_loadToml%VerifyPyprojectDotTomlTests._loadToml   s     <KKMEIE%GGDM 	'..	 
  	q*%%

(/ 	s#   A
A. A+	.B%9'B  B%c                    \         P                  P                  \        \        V P                  4       4      R4      pV P                  \        \        V4       R# )zN
An absent ``pyproject.toml`` file produces no result unless
there is opt-in.
pyproject.tomlN)	osr   joinr   r   r   assertRaisesFileNotFoundErrorr   )r   r   s   & r   test_fileNotFound-VerifyPyprojectDotTomlTests.test_fileNotFound-   s:    
 ww||Ddkkm46FG+-A4Hr   c                L    RpV P                  \        V P                  V4       R# )zp
Syntactially invalid TOML produces an exception. The specific
exception varies by the underlying TOML library.
z[project]
name = "abcN)r)   r   r#   r   r   s   & r   test_brokenToml+VerifyPyprojectDotTomlTests.test_brokenToml5   s    
 ()T^^T:r   c                Z    R F$  pV P                  \        V P                  V4       K&  	  R# )z@
`ValueError` is raised when we can't extract the project name.
N)
z[tool.notincremental]
z
[project]
z[tool.incremental]
z[project]
[tool.incremental]
r)   
ValueErrorr#   r.   s   & r   test_nameMissing,VerifyPyprojectDotTomlTests.test_nameMissing=   s&    
D j$..$?
r   c                    R F;  pV P                  \        R4      ;_uu_ 4        V P                  V4       RRR4       K=  	  R#   + '       g   i     KR  ; i)z=
`TypeError` is raised when the project name isn't a string.
z!The project name must be a stringN)z[project]
name = false
z[tool.incremental]
name = -1
z([tool.incremental]
[project]
name = 1.0
)assertRaisesRegex	TypeErrorr#   r.   s   & r   test_nameInvalidOptIn1VerifyPyprojectDotTomlTests.test_nameInvalidOptInJ   sF    
D
 ''	3VWWt$ XW

 XWWs   AAc                Z    R F$  pV P                  \        V P                  V4       K&  	  R# )zU
`ValueError` is raised when the ``[tool]`` or ``[tool.incremental]``
isn't a table.
N)ztool = false
z[tool]
incremental = false
z[tool]
incremental = 123
z[tool]
incremental = null
r3   r.   s   & r   test_toolIncrementalInvalid7VerifyPyprojectDotTomlTests.test_toolIncrementalInvalidV   s&    

D j$..$?
r   c                Z    R F$  pV P                  \        V P                  V4       K&  	  R# )z`
Raise `ValueError` when the ``[tool.incremental]`` section contains
keys other than ``"name"``
N)z[tool.incremental]
foo = false
z-[tool.incremental]
name = "OK"
other = false
r3   r.   s   & r   !test_toolIncrementalUnexpecteKeys=VerifyPyprojectDotTomlTests.test_toolIncrementalUnexpecteKeysc   s&    

D j$..$?	
r   c                   \        V P                  4       4      pVR,          R,          pVP                  RR7       R
 FC  pV P                  W1R,          R7      pV P	                  V\        RR\        V4      R7      4       KE  	  R	# )z
The package has opted-in to Incremental version management when
the ``[tool.incremental]`` section is a dict. The project name
is taken from ``[tool.incremental] name`` or ``[project] name``.
srcfooTparentsr&   r   Fooopt_inpackager   N)z*[project]
name = "Foo"
[tool.incremental]
z [tool.incremental]
name = "Foo"
r   r   mkdirr#   assertEqualr   r   )r   rootpkgr   configs   &    r   test_setuptoolsOptIn0VerifyPyprojectDotTomlTests.test_setuptoolsOptInn   sz     DKKM"UlU"		$	
D ^^D6F/F^GF"!S
r   c                   \        V P                  4       4      pVP                  4        V P                  \        R4      ;_uu_ 4        V P                  RVR,          R7       RRR4       R#   + '       g   i     R# ; i)z=
Raise `ValueError` when the package root can't be resolved.
z$Can't find the directory of project z[project]
name = "foo"
r&   rG   N)r   r   rM   r8   r4   r#   )r   rO   s   & r   test_packagePathRequired4VerifyPyprojectDotTomlTests.test_packagePathRequired   s^     DKKM"

##J0VWWNN+,,   XWWWs   A--A>	c           
         \        V P                  4       4      pVR,          R,          pVP                  RR7       V P                  RVR,          R7      pV P	                  V\        RR	\        V4      R
7      4       R# )zl
The ``[tool.incremental]`` table is not strictly required, but its
``opt_in=False`` indicates its absence.
rC   rD   TrE   z[project]
name = "Foo"
r&   rG   FrH   rI   NrL   )r   rO   rP   rQ   s   &   r   test_noToolIncrementalSection9VerifyPyprojectDotTomlTests.test_noToolIncrementalSection   sw    
 DKKM"UlU"		$	'((   

 	X	
r    )__name__
__module____qualname____firstlineno____doc__r#   r+   r/   r5   r:   r=   r@   rR   rU   rX   __static_attributes____classdictcell__)r   s   @r   r
   r
      sP     9;? 8I;@
%@	@2
 
r   r
   )r_   r'   typingr   r   r   pathlibr   twisted.trial.unittestr   incrementalr   r   r
   rZ   r   r   <module>rf      s*    8 	 ( (  + @[
( [
r   