o
    DDid                     @   sD   d dl mZ d dlmZ d dlmZ d dlmZ G dd deZdS )    )dedent)parse_module)UnitTest)dumpc                   @   s\   e Zd ZdddZdddZdddZdd	d
ZdddZdddZdddZ	dddZ
dS )CSTDumpTextTestreturnNc              	   C   8   d}|  t|dd  d d ttddddd d S )Na  
            Module(
              body=[
                FunctionDef(
                  name=Name(
                    value='foo',
                    lpar=[],
                    rpar=[],
                  ),
                  params=Parameters(
                    params=[
                      Param(
                        name=Name(
                          value='a',
                          lpar=[],
                          rpar=[],
                        ),
                        annotation=Annotation(
                          annotation=Name(
                            value='str',
                            lpar=[],
                            rpar=[],
                          ),
                          whitespace_before_indicator=SimpleWhitespace(
                            value='',
                          ),
                          whitespace_after_indicator=SimpleWhitespace(
                            value=' ',
                          ),
                        ),
                        equal=MaybeSentinel.DEFAULT,
                        default=None,
                        comma=MaybeSentinel.DEFAULT,
                        star='',
                        whitespace_after_star=SimpleWhitespace(
                          value='',
                        ),
                        whitespace_after_param=SimpleWhitespace(
                          value='',
                        ),
                      ),
                    ],
                    star_arg=MaybeSentinel.DEFAULT,
                    kwonly_params=[],
                    star_kwarg=None,
                    posonly_params=[],
                    posonly_ind=MaybeSentinel.DEFAULT,
                  ),
                  body=IndentedBlock(
                    body=[
                      SimpleStatementLine(
                        body=[
                          Pass(
                            semicolon=Semicolon(
                              whitespace_before=SimpleWhitespace(
                                value=' ',
                              ),
                              whitespace_after=SimpleWhitespace(
                                value=' ',
                              ),
                            ),
                          ),
                          Pass(
                            semicolon=MaybeSentinel.DEFAULT,
                          ),
                        ],
                        leading_lines=[],
                        trailing_whitespace=TrailingWhitespace(
                          whitespace=SimpleWhitespace(
                            value='',
                          ),
                          comment=None,
                          newline=Newline(
                            value=None,
                          ),
                        ),
                      ),
                      SimpleStatementLine(
                        body=[
                          Return(
                            value=None,
                            whitespace_after_return=SimpleWhitespace(
                              value='',
                            ),
                            semicolon=MaybeSentinel.DEFAULT,
                          ),
                        ],
                        leading_lines=[],
                        trailing_whitespace=TrailingWhitespace(
                          whitespace=SimpleWhitespace(
                            value='',
                          ),
                          comment=None,
                          newline=Newline(
                            value=None,
                          ),
                        ),
                      ),
                    ],
                    header=TrailingWhitespace(
                      whitespace=SimpleWhitespace(
                        value='',
                      ),
                      comment=None,
                      newline=Newline(
                        value=None,
                      ),
                    ),
                    indent=None,
                    footer=[],
                  ),
                  decorators=[],
                  returns=Annotation(
                    annotation=Name(
                      value='None',
                      lpar=[],
                      rpar=[],
                    ),
                    whitespace_before_indicator=SimpleWhitespace(
                      value=' ',
                    ),
                    whitespace_after_indicator=SimpleWhitespace(
                      value=' ',
                    ),
                  ),
                  asynchronous=None,
                  leading_lines=[],
                  lines_after_decorators=[],
                  whitespace_after_def=SimpleWhitespace(
                    value=' ',
                  ),
                  whitespace_after_name=SimpleWhitespace(
                    value='',
                  ),
                  whitespace_before_params=SimpleWhitespace(
                    value='',
                  ),
                  whitespace_before_colon=SimpleWhitespace(
                    value='',
                  ),
                  type_parameters=None,
                  whitespace_after_type_parameters=SimpleWhitespace(
                    value='',
                  ),
                ),
              ],
              header=[],
              footer=[],
              encoding='utf-8',
              default_indent='    ',
              default_newline='\n',
              has_trailing_newline=True,
            )
           4def foo(a: str) -> None:
    pass ; pass
    return
Tshow_whitespaceshow_defaultsshow_syntaxassertEqualr   r   r   selfmodule r   \/var/www/Datamplify/venv/lib/python3.10/site-packages/libcst/display/tests/test_dump_text.pytest_full_tree   s    zCSTDumpTextTest.test_full_treec              	   C   8   d}|  t|dd  d d ttddddd d S )Na	  
            Module(
              body=[
                FunctionDef(
                  name=Name(
                    value='foo',
                    lpar=[],
                    rpar=[],
                  ),
                  params=Parameters(
                    params=[
                      Param(
                        name=Name(
                          value='a',
                          lpar=[],
                          rpar=[],
                        ),
                        annotation=Annotation(
                          annotation=Name(
                            value='str',
                            lpar=[],
                            rpar=[],
                          ),
                        ),
                        equal=MaybeSentinel.DEFAULT,
                        default=None,
                        comma=MaybeSentinel.DEFAULT,
                        star='',
                      ),
                    ],
                    star_arg=MaybeSentinel.DEFAULT,
                    kwonly_params=[],
                    star_kwarg=None,
                    posonly_params=[],
                    posonly_ind=MaybeSentinel.DEFAULT,
                  ),
                  body=IndentedBlock(
                    body=[
                      SimpleStatementLine(
                        body=[
                          Pass(
                            semicolon=Semicolon(),
                          ),
                          Pass(
                            semicolon=MaybeSentinel.DEFAULT,
                          ),
                        ],
                      ),
                      SimpleStatementLine(
                        body=[
                          Return(
                            value=None,
                            semicolon=MaybeSentinel.DEFAULT,
                          ),
                        ],
                      ),
                    ],
                  ),
                  decorators=[],
                  returns=Annotation(
                    annotation=Name(
                      value='None',
                      lpar=[],
                      rpar=[],
                    ),
                  ),
                  asynchronous=None,
                  type_parameters=None,
                ),
              ],
              encoding='utf-8',
              default_indent='    ',
              default_newline='\n',
              has_trailing_newline=True,
            )
        r	   r
   r   FTr   r   r   r   r   r   test_hidden_whitespace   s   Oz&CSTDumpTextTest.test_hidden_whitespacec              	   C   8   d}|  t|dd  d d ttddddd d S )NaV  
            Module(
              body=[
                FunctionDef(
                  name=Name(
                    value='foo',
                  ),
                  params=Parameters(
                    params=[
                      Param(
                        name=Name(
                          value='a',
                        ),
                        annotation=Annotation(
                          annotation=Name(
                            value='str',
                          ),
                          whitespace_before_indicator=SimpleWhitespace(
                            value='',
                          ),
                        ),
                        star='',
                      ),
                    ],
                  ),
                  body=IndentedBlock(
                    body=[
                      SimpleStatementLine(
                        body=[
                          Pass(
                            semicolon=Semicolon(
                              whitespace_before=SimpleWhitespace(
                                value=' ',
                              ),
                              whitespace_after=SimpleWhitespace(
                                value=' ',
                              ),
                            ),
                          ),
                          Pass(),
                        ],
                      ),
                      SimpleStatementLine(
                        body=[
                          Return(
                            whitespace_after_return=SimpleWhitespace(
                              value='',
                            ),
                          ),
                        ],
                      ),
                    ],
                  ),
                  returns=Annotation(
                    annotation=Name(
                      value='None',
                    ),
                    whitespace_before_indicator=SimpleWhitespace(
                      value=' ',
                    ),
                  ),
                ),
              ],
            )
        r	   r
   r   TFr   r   r   r   r   r   test_hidden_defaults     Dz$CSTDumpTextTest.test_hidden_defaultsc              	   C   8   d}|  t|dd  d d ttddddd d S )Naq  
            Module(
              body=[
                FunctionDef(
                  name=Name(
                    value='foo',
                  ),
                  params=Parameters(
                    params=[
                      Param(
                        name=Name(
                          value='a',
                        ),
                        annotation=Annotation(
                          annotation=Name(
                            value='str',
                          ),
                        ),
                        star='',
                      ),
                    ],
                  ),
                  body=IndentedBlock(
                    body=[
                      SimpleStatementLine(
                        body=[
                          Pass(
                            semicolon=Semicolon(),
                          ),
                          Pass(),
                        ],
                      ),
                      SimpleStatementLine(
                        body=[
                          Return(),
                        ],
                      ),
                    ],
                  ),
                  returns=Annotation(
                    annotation=Name(
                      value='None',
                    ),
                  ),
                ),
              ],
            )
        r	   r
   r   FTr   r   r   r   r   r   #test_hidden_whitespace_and_defaults_  s   3z3CSTDumpTextTest.test_hidden_whitespace_and_defaultsc              	   C   r   )Na  
            Module(
              body=[
                FunctionDef(
                  name=Name(
                    value='foo',
                    lpar=[],
                    rpar=[],
                  ),
                  params=Parameters(
                    params=[
                      Param(
                        name=Name(
                          value='a',
                          lpar=[],
                          rpar=[],
                        ),
                        annotation=Annotation(
                          annotation=Name(
                            value='str',
                            lpar=[],
                            rpar=[],
                          ),
                          whitespace_before_indicator=SimpleWhitespace(
                            value='',
                          ),
                          whitespace_after_indicator=SimpleWhitespace(
                            value=' ',
                          ),
                        ),
                        default=None,
                        star='',
                        whitespace_after_star=SimpleWhitespace(
                          value='',
                        ),
                        whitespace_after_param=SimpleWhitespace(
                          value='',
                        ),
                      ),
                    ],
                    star_arg=MaybeSentinel.DEFAULT,
                    kwonly_params=[],
                    star_kwarg=None,
                    posonly_params=[],
                    posonly_ind=MaybeSentinel.DEFAULT,
                  ),
                  body=IndentedBlock(
                    body=[
                      SimpleStatementLine(
                        body=[
                          Pass(),
                          Pass(),
                        ],
                        leading_lines=[],
                        trailing_whitespace=TrailingWhitespace(
                          whitespace=SimpleWhitespace(
                            value='',
                          ),
                          comment=None,
                          newline=Newline(
                            value=None,
                          ),
                        ),
                      ),
                      SimpleStatementLine(
                        body=[
                          Return(
                            value=None,
                            whitespace_after_return=SimpleWhitespace(
                              value='',
                            ),
                          ),
                        ],
                        leading_lines=[],
                        trailing_whitespace=TrailingWhitespace(
                          whitespace=SimpleWhitespace(
                            value='',
                          ),
                          comment=None,
                          newline=Newline(
                            value=None,
                          ),
                        ),
                      ),
                    ],
                    header=TrailingWhitespace(
                      whitespace=SimpleWhitespace(
                        value='',
                      ),
                      comment=None,
                      newline=Newline(
                        value=None,
                      ),
                    ),
                    indent=None,
                    footer=[],
                  ),
                  decorators=[],
                  returns=Annotation(
                    annotation=Name(
                      value='None',
                      lpar=[],
                      rpar=[],
                    ),
                    whitespace_before_indicator=SimpleWhitespace(
                      value=' ',
                    ),
                    whitespace_after_indicator=SimpleWhitespace(
                      value=' ',
                    ),
                  ),
                  asynchronous=None,
                  leading_lines=[],
                  lines_after_decorators=[],
                  whitespace_after_def=SimpleWhitespace(
                    value=' ',
                  ),
                  whitespace_after_name=SimpleWhitespace(
                    value='',
                  ),
                  whitespace_before_params=SimpleWhitespace(
                    value='',
                  ),
                  whitespace_before_colon=SimpleWhitespace(
                    value='',
                  ),
                  type_parameters=None,
                  whitespace_after_type_parameters=SimpleWhitespace(
                    value='',
                  ),
                ),
              ],
              header=[],
              footer=[],
            )
        r	   r
   r   TFr   r   r   r   r   r   test_hidden_syntax  s    z"CSTDumpTextTest.test_hidden_syntaxc              	   C   r   )Na  
            Module(
              body=[
                FunctionDef(
                  name=Name(
                    value='foo',
                    lpar=[],
                    rpar=[],
                  ),
                  params=Parameters(
                    params=[
                      Param(
                        name=Name(
                          value='a',
                          lpar=[],
                          rpar=[],
                        ),
                        annotation=Annotation(
                          annotation=Name(
                            value='str',
                            lpar=[],
                            rpar=[],
                          ),
                        ),
                        default=None,
                        star='',
                      ),
                    ],
                    star_arg=MaybeSentinel.DEFAULT,
                    kwonly_params=[],
                    star_kwarg=None,
                    posonly_params=[],
                    posonly_ind=MaybeSentinel.DEFAULT,
                  ),
                  body=IndentedBlock(
                    body=[
                      SimpleStatementLine(
                        body=[
                          Pass(),
                          Pass(),
                        ],
                      ),
                      SimpleStatementLine(
                        body=[
                          Return(
                            value=None,
                          ),
                        ],
                      ),
                    ],
                  ),
                  decorators=[],
                  returns=Annotation(
                    annotation=Name(
                      value='None',
                      lpar=[],
                      rpar=[],
                    ),
                  ),
                  asynchronous=None,
                  type_parameters=None,
                ),
              ],
            )
        r	   r
   r   FTr   r   r   r   r   r   !test_hidden_whitespace_and_syntax3  r   z1CSTDumpTextTest.test_hidden_whitespace_and_syntaxc              	   C   r   )Na  
            Module(
              body=[
                FunctionDef(
                  name=Name(
                    value='foo',
                  ),
                  params=Parameters(
                    params=[
                      Param(
                        name=Name(
                          value='a',
                        ),
                        annotation=Annotation(
                          annotation=Name(
                            value='str',
                          ),
                          whitespace_before_indicator=SimpleWhitespace(
                            value='',
                          ),
                        ),
                        star='',
                      ),
                    ],
                  ),
                  body=IndentedBlock(
                    body=[
                      SimpleStatementLine(
                        body=[
                          Pass(),
                          Pass(),
                        ],
                      ),
                      SimpleStatementLine(
                        body=[
                          Return(
                            whitespace_after_return=SimpleWhitespace(
                              value='',
                            ),
                          ),
                        ],
                      ),
                    ],
                  ),
                  returns=Annotation(
                    annotation=Name(
                      value='None',
                    ),
                    whitespace_before_indicator=SimpleWhitespace(
                      value=' ',
                    ),
                  ),
                ),
              ],
            )
        r	   r
   r   TFr   r   r   r   r   r   test_hidden_defaults_and_syntax  s   ;z/CSTDumpTextTest.test_hidden_defaults_and_syntaxc              	   C   r   )Na#  
            Module(
              body=[
                FunctionDef(
                  name=Name(
                    value='foo',
                  ),
                  params=Parameters(
                    params=[
                      Param(
                        name=Name(
                          value='a',
                        ),
                        annotation=Annotation(
                          annotation=Name(
                            value='str',
                          ),
                        ),
                        star='',
                      ),
                    ],
                  ),
                  body=IndentedBlock(
                    body=[
                      SimpleStatementLine(
                        body=[
                          Pass(),
                          Pass(),
                        ],
                      ),
                      SimpleStatementLine(
                        body=[
                          Return(),
                        ],
                      ),
                    ],
                  ),
                  returns=Annotation(
                    annotation=Name(
                      value='None',
                    ),
                  ),
                ),
              ],
            )
        r	   r
   r   Fr   r   r   r   r   r   .test_hidden_whitespace_and_defaults_and_syntax  s   1z>CSTDumpTextTest.test_hidden_whitespace_and_defaults_and_syntax)r   N)__name__
__module____qualname__r   r   r   r   r   r    r!   r"   r   r   r   r   r      s    
 
)
Z
O
> 

OFr   N)	textwrapr   libcstr   libcst.testing.utilsr   libcst.toolr   r   r   r   r   r   <module>   s
   