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

Docs don't match implementation #9

Open
mgoodhand opened this issue Oct 16, 2017 · 3 comments
Open

Docs don't match implementation #9

mgoodhand opened this issue Oct 16, 2017 · 3 comments

Comments

@mgoodhand
Copy link

The documentation in the README and on pypi is out of sync with the implementation (1.2.0):

>>> stringcase.constcase('FooBarBaz') # => "_FOO_BAR_BAZ"
'FOO_BAR_BAZ'
>>> stringcase.pathcase('FooBarBaz') # => "/foo/bar/baz"
'foo/bar/baz'
>>> stringcase.snakecase('FooBarBaz') # => "_foo_bar_baz"
'foo_bar_baz'
>>> stringcase.spinalcase('FooBarBaz') # => "-foo-bar-baz"
'foo-bar-baz'
>>> stringcase.titlecase('FooBarBaz') # => " Foo Bar Baz"
'Foo Bar Baz'
>>> stringcase.alphanumcase('_Foo., Bar') # =>'FooBar'
'_FooBar'

For all except the last one, I think the code is doing the right thing and the docs are wrong.

I presume alphanumcase is meant to drop all non-alphanumeric characters, so the fact that it currently retains '_' seems problematic.

@ShivaShankerReddy
Copy link

@mgoodhand the current docs are showing correctly.
stringcase.alphanumcase('_Foo., Bar') # =>'FooBar'

@mgoodhand
Copy link
Author

mgoodhand commented Dec 16, 2019

Yes, the docs for alphanumcase are correct, but the implementation seems wrong:

(env) eden:tmp mrg$ pip install stringcase
Collecting stringcase
Installing collected packages: stringcase
Successfully installed stringcase-1.2.0
You are using pip version 19.0.3, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
(env) eden:tmp mrg$ python
Python 3.7.4 (default, Jul  9 2019, 18:13:23)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import stringcase
>>> stringcase.alphanumcase('_Foo., Bar') # =>'FooBar'
'_FooBar'
>>> stringcase.alphanumcase('Foo_123 Bar!')
'Foo_123Bar'

@mgoodhand
Copy link
Author

For the other ones mentioned, it's the documentation that's wrong, e.g.

>>> stringcase.constcase('FooBarBaz') # => "_FOO_BAR_BAZ"
'FOO_BAR_BAZ'

The implementation matches what I'd expect (FOO_BAR_BAZ), but the documentation includes a leading underscore (_FOO_BAR_BAZ).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants