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

Need to correct error message for Bytes checker #63

Closed
Arfey opened this issue Oct 1, 2019 · 7 comments
Closed

Need to correct error message for Bytes checker #63

Arfey opened this issue Oct 1, 2019 · 7 comments

Comments

@Arfey
Copy link
Collaborator

Arfey commented Oct 1, 2019

In [19]: t.Bytes().check(b'test') 
Out[19]: b'test'

In [18]: t.Bytes().check('test')
... 
DataError: value is not a string

In my opinion we need to change string to bytes string.

@tyulpan
Copy link
Contributor

tyulpan commented Oct 1, 2019

But isn't this code handling invalid values, or am I wrong?

self._failure('Value is not bytes', value=value)

@Arfey
Copy link
Collaborator Author

Arfey commented Oct 1, 2019

I put to check method string and after that receive error value is not a string.

@tyulpan
Copy link
Contributor

tyulpan commented Oct 1, 2019

I did the same and got:

In [1]: base.Bytes().check(b'test') 
Out[1]: 'test'

In [2]: base.Bytes().check('test')
... 
DataError: Value is not bytes

But I did import as import trafaret.base as base, because the Bytes class isn't in the __init__.py file. That's why it seems to me that I am doing something wrong.

@Arfey
Copy link
Collaborator Author

Arfey commented Oct 1, 2019

import trafaret as t

t.__VERSION__ 
(2, 0, '0-alpha.04')

@Arfey
Copy link
Collaborator Author

Arfey commented Oct 1, 2019

if u wanna install alpha version u can use that:

pip install https://github.com/Deepwalker/trafaret/archive/version2.zip

@tyulpan
Copy link
Contributor

tyulpan commented Oct 1, 2019

Yep, DataError: value is not a string 😄

@Arfey
Copy link
Collaborator Author

Arfey commented Oct 1, 2019

thx :)

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