Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(help): finish #381 for RsT to print enum-choices #438

Merged
merged 2 commits into from Aug 15, 2017

Conversation

ankostis
Copy link
Contributor

#381 inserted a new line Choices: x, y, z into the help and config messages for all Enum traits, immediately above Default: ... line.
As had been mentioned in that PR, that feature was never added to the RsT documentation produced by Configurable.class_config_rst_doc() classs method.
This PR fixes that neglect.

  • Had to add an optional as_rst=false kwd to allXxxEnum.info() methods.
  • Added TCs for info().

RsT samples for info() method:

  • Enum & UseEnum traits:

    any of ``'red'``|``'Green'``|``'BLUE'``|``'YeLLoW'`` or `None`
    
  • CaselessStrEnum:

    any of ``'red'``|``'Green'``|``'BLUE'``|``'YeLLoW'`` (case-insensitive) or `None`
    
  • FuzzyEnum:

    any case-insensitive prefix of ``'red'``|``'Green'``|``'BLUE'``|``'YeLLoW'`` or `None`
    

+ Had to add `as_rst=false` kwd to all `XxxEnum.info()` methods.
+ Added TCs for `info()`.
choices = repr(list(choices))
return choices

def info(self, as_rst=False):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding an as_rst arg is a backward-incompatible change because user traits can have defined .info() accepting no arguments, which must not result in any errors.

Maybe better to define a new .info_rst() method that calls .info() by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@minrk minrk merged commit e9acdb5 into ipython:master Aug 15, 2017
@minrk minrk added this to the 5.0 milestone Aug 15, 2017
@Carreau Carreau added 5.0-re-review Need to re-review for potential API impact changes. 5.0-minor rereviewed, minor change need to be put in changelog. and removed 5.0-re-review Need to re-review for potential API impact changes. labels Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.0-minor rereviewed, minor change need to be put in changelog.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants