Ad
  • Custom User Avatar

    Did you read this in the description:

    Content is in fact not necessary in the body of the function "evaporator", you can use it or not use it ...

  • Custom User Avatar

    (most tags are actually automatic, hence most aren't appropriate: the heuristic used is rather poor)

  • Custom User Avatar

    I suggest reading this
    https://docs.python.org/3/reference/datamodel.html#special-method-names
    And implement a linked list class, supporting iteration, indexing (get and set, possibly slicing), string conversion, concatenation, ==, < >

    I imagine kata's using the class tag all sprinkled on some oop dust without it being very meaningful.

  • Custom User Avatar

    Ah. Right. Actually I could not see it. Hadn't solved it. Have now.
    Your test code:

    names = ['myClass', 'newClass', 'My Class', 'MyClass!', ' MyClass', '2ndMyClass!', '2ndMyClass']
    for i in names:    
        test.expect_error('Invalid Class name!', class_name_changer(MyClass, i))
    

    will crash for a correct solution, because a correct solution will raise an exception and it isn't caught.
    note that you're calling your solution before calling test.expect_error, any exception will already have happened before test.expect_error gets to run

    it's equivalent to this:

    names = ['myClass', 'newClass', 'My Class', 'MyClass!', ' MyClass', '2ndMyClass!', '2ndMyClass']
    for i in names:    
        myresult = class_name_changer(MyClass, i)  # error (also, pointless because the return value is None)
        test.expect_error('Invalid Class name!', myresult)
    

    What you need to do is ..

    names = ['myClass', 'newClass', 'My Class', 'MyClass!', ' MyClass', '2ndMyClass!', '2ndMyClass']
    for i in names:    
        test.expect_error('Invalid Class name!', lambda: class_name_changer(MyClass, i))
    
  • Custom User Avatar

    yes, because of the spoiler flag and the fact that you didn't solve the kata yet. But we can see it.

    What I don't understand is why you expect this to fail, for one, and for two, that's not th syntax to use with test.expect_error, iirc

    actually, I don't get what the problem is. What is, according to your point of view, the problem in the full test suite? Can you provide a precise example? (input/actual output/expected output)

  • Custom User Avatar

    What exact code did you add to your sample cases?
    You're probably adding something different from what's in the test cases.

  • Custom User Avatar

    I just checkd and everything is working correctly in python... => ?

  • Custom User Avatar

    What did you try to prove/do exactly, with this? I cannot follow what you say, sorry.

  • Custom User Avatar

    Thanks for feedback. The Kata description is updated to clarify that...

  • Custom User Avatar

    Should be fixed now.

  • Custom User Avatar

    Agreed, there might be some math involved.

  • Custom User Avatar

    Can be optimized to handle an upper bound of 1,000,000 once you found out what is the most time-consuming part.