6 kyu

Timer Decorator

Description
Loading description...
Fundamentals
Design Patterns
Object-oriented Programming
Date Time
  • Please sign in or sign up to leave a comment.
  • vlkaz426 Avatar

    If you have failed tests starting from the 6th test, and you dont have any idea what's wrong, you should know that:

    1. The main function requies some input args.
    2. Initial 'limit' value could be non-integer (float).

    Note to kata creator: Kata instruction is not full, there is nothing about that conditions (please complement).

  • vtyw93 Avatar

    The test needs to include functions with named parameters because currently a solution that ignores named parameters still passes.

  • freeman.sh Avatar

    It would be much better to have logging for failed test cases input values

    as it is pretty hard to debug and underdsand which value has failed

    Test Passed

    Test Failed

    True should equal False # ???

    I've seen other katas tests support this feature, e.g.:

    test.assert_equals(number(["a", "b", "c"]), ["1: a", "2: b", "3: c"])

    fails with:

    Should handle ["a", "b", "c"] as ["1: a", "2: b", 3: c"]

    ['a', 'b', 'c'] should equal ['1: a', '2: b', '3: c']

    • Blind4Basics Avatar

      is that the 6th test, that you're failing?

    • freeman.sh Avatar

      I tried to perform some experiments and used datetime module instead suggested time. And correct, all tests starting from 6th started failing for me, but I was unable to get a glue what happened there under the hood.

    • Blind4Basics Avatar

      if all tests starting from the 6th are failing, that means your code is incorrect. You should print stuf to the console: the limit and the timings you use. Check that the precision is good enough with what you use too.

    • freeman.sh Avatar

      I've already submitted another successful solution. Just wanted to notify creator of this kata about minor inconvenience during failed tests debug (in comparison with other katas).

      Yeah, printing input values is a nice workaround, btw.

  • Emilnurg Avatar

    Needs random tests (Cause my cheating solution shouldn't work :)

  • sperry Avatar

    It would be better to clarify: "within a given seconds interval" means < or <= ? Surprisingly, both variants are acceptable now. Was it intended? ;) And tag "Dates/Time" will not be superfluous. Thanks for interesting kata!

    • filipkonieczny Avatar

      Hey sperry, thanks for the kind words!

      I added (less than) to the description to clarify what I had in mind. It was intended to be "<" and I put that in my solution. I'm afraid it could be hard to check when it comes to time and Codewars, as the result may vary, and so on. :)

      I also added "Dates/Time" tag.

      Cheers!