Ad
  • Custom User Avatar

    Specified to use POST request parameter "code" but was not found in attempt test. OK, it makes sense for the usual test, I use an if-else statement to catch if it's None, but it's always None. Great idea once again, but requires some fixing

  • Custom User Avatar

    Great kata idea! However, sometimes the code runs too slow and won't fit inside of the time limit. Try using a

    @test.timeout(seconds)
    def something():
        #Tests go here
        pass
    

    For more documentation, refer to https://docs.codewars.com/languages/python/codewars-test/

  • Custom User Avatar

    I see that this is a series and is presumable building to something but I don't think having the /reset route really adds anything to the experience at this point. also the description of the return dict felt a little awkward if it were just given in the dict litteral form of {'toreturn':'whatireturned'} I don't think you would be giving to much away.

    That being said I enjoyed it and I'm going to try to go through the rest of this series.

  • Custom User Avatar

    Test cases in Python would be better if they were factorized a bit more. Currently, there are many repetitions. It's easy to create a generic function dotest that does the job for all tests, fixed and random. That would lighten the tests page and would be much more readable. Something like:

    def dotest(inputs..., expected):
      actual = user_function(inputs)
      message = f"some formatted string"
      test.assert_equals(actual, expected, message)
      
      # then just do in the tests:
      dotest(inputs..., expected)
    
  • Custom User Avatar

    I found the description very confusing and only figured out what json post key I was supposed to use by looking at the test cases. I have provided a rewrite for the code descriptions below that will hopefully make this kata a bit more clear for future codwarriors:

    Implement a flask webserver that runs on localhost:4000 for host:port respectively.

    There should be two routes:

    1. Home route '/' that responds to [GET] requests with the dictionary {'toreturn':'whatitreturned'}.
    2. Reset route '/reset' that responds to [POST] requests with the json value for attribute "code".

    Your flask webserver's Flask.run() method should be called from the runner() method.

  • Custom User Avatar

    JS Translation Also to bump the kata (for Approval, maybe?)

    • Prettified the description a bit (if that is a valid word)

    Edit: Actually no, a complete rework of the description

  • Custom User Avatar

    The required return value of /reset route is grossly unspecified.

  • Default User Avatar

    The expected socket type is SOCK_STREAM, so there are no message boundaries and it's not clear how much data should be read. It's a stream, so a read operation may read an arbitrary amount of data. A client should know how much data to expect before it should stop reading.

  • Custom User Avatar

    What is the point of testing m < 0?