Ad
  • Custom User Avatar

    removed => isinstance is now allowed

  • Custom User Avatar
  • Custom User Avatar

    handled, testing only at Model instantiation time. Oh, I forgot to talk about default taking precedence over auto_now. I'll add that in the next fork.

  • Custom User Avatar

    suppressed the meaningless requirement (and updated the description)

  • Default User Avatar

    Thanks again for the feedback and the time you spent on this! I did have to check my validation, probably have to refactor it later.

  • Default User Avatar

    Tests passed! Thanks for modifying the tests! Really helped a lot!

  • Default User Avatar

    Thanks for looking into it and spending the time! I really appreciate it. I will look into to checking your comment on the DatetimeField.

  • Custom User Avatar

    I updated the tests so that the error message tells what fields are incorrect. Please reset the trainer and reload the page (don't forget to copy your current code first).

  • Custom User Avatar

    I just tried your code: you're actually looking at the wrong field (dunno why). Your code fails on instances where the DateTimeField is wrong, not the IntegerField.

  • Default User Avatar

    Noted and already done! It failing on the integer field in every case. Since the validation in the User class should have access to both the Integerfield and the data for it, I have checked it more than once.

    This is what my logs look like before they fail

    '''

    • model validation fields: {'char_': <solution.CharField object at 0x7f45c1367a50>, 'email_': <solution.EmailField object at 0x7f45c1367b10>, 'bool_': <solution.BooleanField object at 0x7f45c1367c10>, 'date_': <solution.DateTimeField object at 0x7f45c13677d0>, 'int_': <solution.IntegerField object at 0x7f45c1367790>}
    • initial_data: {'char_': False, 'email_': None, 'bool_': True, 'date_': datetime.datetime(2003, 9, 10, 0, 0), 'int_': None}
    • <solution.IntegerField object at 0x7f45c1367790>
    • int value: None
    • field args: {'default': None, 'blank': True, 'min_value': -100, 'max_value': 100}
    • value type <class 'NoneType'>

    '''

    Test response in this case with "Validation should have failed" while in previous cases with similiar data of None and fields args, it allows it

  • Custom User Avatar

    note: double check what is the actual field: you don't provide the info, so I bet one case uses an IntegerField while the other is a BooleanField or something else.

  • Default User Avatar

    "Also, each field type has parameters blank (default False) which determines whether None is allowed as a value, and default (default None) which determines the value to be used if nothing was provided.
    Each field type should have its own validate method which checks whether the provided value has the correct type and satisfies the length/value constraints." Kata description

    Similar to the Django application, None is allowed is an Integer field, allowed to be able to be modified after instance creation. Validation according to the kata should take place when the validate method is invoked. Additionally, some tests when with None as a value work fine while others dont. Even some values that do have an integer that fullfil the min/max value still fail for some reason.

  • Custom User Avatar

    can you provide the exact assertion/error message? edit: sec...

    int value: None
    field args: {'default': None, 'blank': True, 'min_value': -100, 'max_value': 100}
    result: passes validation method
    test returns: "Validation should have failed"
    

    why do you expect this case to be valid? The field is (I guess) supposed to be an IntegerField where None is allowed as default (when creating the field), but None is not an integer so it should still fail at validation time. => ?

  • Default User Avatar

    From what I can see, the random tests create User instances and run the validation method on the created instance. I think some of the tests assertions might be wrong. All the examples mentioned above are snippets from the random tests failing when running the validation method on the user instance. Some of the results of the random test dont match the kata description.

  • Custom User Avatar

    At this point, I'm not sure if its me not getting the point or if theres an issue with the random tests.

    Meaning you should have opened a Question instead of an Issue.

    Note that the test configuration isn't enough to sort out your problem, because not every single test is calling the validation function (which is the one that is raising the errors). So I think this is your current problem: are you validating at the right time?

    Closing, as "not an issue", but you can keep posting on the thread.

    Cheers

  • Loading more items...