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

pvalid errors out on validating only one arg #66

Open
nagesh-chowdaiah opened this issue Oct 30, 2020 · 2 comments
Open

pvalid errors out on validating only one arg #66

nagesh-chowdaiah opened this issue Oct 30, 2020 · 2 comments
Labels
Milestone

Comments

@nagesh-chowdaiah
Copy link

nagesh-chowdaiah commented Oct 30, 2020

from pyvalid import accepts
import pandas as pd
from pyvalid.validators import NumberValidator


class Mention:
    @accepts(object,
             overlap_percentage=NumberValidator(min_val=0.0, max_val=1.0)
             )
    def __init__(self, df: pd.DataFrame, presence_col: str, overlap_percentage=1.2) -> None:
        pass


Mention(None,"abc",0.9)

Traceback (most recent call last):
File "example.py", line 14, in
Mention(None,"abc",0.9)
File "C:\Users\40102447\oss\pyvalid\pyvalid__accepts.py", line 88, in decorator_wrapper
self.__validate_args(func, func_args, func_kwargs)
File "C:\Users\40102447\oss\pyvalid\pyvalid__accepts.py", line 196, in __validate_args
raise ArgumentValidationError(func, ord_num, value, allowed_values)
pyvalid.__exceptions.ArgumentValidationError: The 2nd argument of the "init(self, df: pandas.core.frame.DataFrame, presence_col: str, overlap_percentage=1.2) -> None" functi
on is "None" of the "<class 'NoneType'>" type, while expected values are: "[<pyvalid.validators.__number.NumberValidator object at 0x000001B9AC892730>]".

@nagesh-chowdaiah nagesh-chowdaiah changed the title pvalid errors out on validating only on arg pvalid errors out on validating only one arg Oct 30, 2020
@eterey
Copy link
Owner

eterey commented Oct 31, 2020

Hey @nagesh-chowdaiah ,
I'll investigate this issue and prepare unit tests / fixes.
Thanks!

@eterey
Copy link
Owner

eterey commented Nov 2, 2020

Hey @nagesh-chowdaiah ,

In the 38f1d19 commit I've added the unit test based on the example, which you provided. It causes the same exception. I'll try to find the root cause and fix it.

Thanks for informing me about this issue!

@eterey eterey added the bug label Nov 4, 2020
@eterey eterey added this to the 1.1 milestone Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants