Ad
  • Custom 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.

  • Custom User Avatar

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

  • Custom 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

    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

    "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

    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

    Some of the random tests for IntegerFields are returning failures contrary to the Kata description and requirements. I have accounted for bool, string and None types in the validation method after refering to previous issues and comments in the discourse.

    Examples of Tests working:

    • Example 1:
      • Input value: 89
      • field args: {'default': None, 'blank': False, 'min_value': -100, 'max_value': 100}
      • result: passes validation method and random test
    • Example 2:
      • int value: None
      • field args: {'default': None, 'blank': True, 'min_value': -100, 'max_value': 100}
      • result: passes validation method and random test

    Examples of Tests not working:

    • Example 1:
      • int value: -4
      • field args: {'default': None, 'blank': False, 'min_value': -100, 'max_value': 100}
      • result: passes validation method and test returns "Validation should have failed"
    • Example 2:
      • int value: 43
      • field args: {'default': None, 'blank': True, 'min_value': -100, 'max_value': 100}
      • result: passes validation method
      • test returns: "Validation should have failed"
    • Example 3:
      • 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"

    At this point, I'm not sure if its me not getting the point or if theres an issue with the random tests. Any feedback will be greatly appreciated