• I think the rangom tests violate the given assumptions: 'there will always be a rank 1 in the given input ranks are of type string
    rank numbers are incremented, and not skippped (1.1 could be followed by 1.2, not 1.3)'
    Random test:
    ['2', '2.1', '2.1.1.1', '2.1.1.1.2', '2.1.1.2', '3', '4']
    ^ no ^ skipping 2.1.1 here
    rank 1 here

  • I've switched the expected and actual assertion arguments.

  • I've added a bunch of randomised test cases that use a subset of the available test cases.

  • Yes, I saw the "shuffle part" of the tests. But the solution being always the same, it could be hard coded without a real random test.

    Regards,
    B4B

  • I added # at the end and got accepted as a valid, separate solution.
    I don't know what is causing this, but thanks for letting me know :)

  • @Blind4Basics,

    The six main tests are somewhat random (using random.shuffle) but they could be better. Generating random "version" strings would not be difficult at all and you could test many more (I usually see ~100 random tests on most katas).

    Thanks for mentioning that!

  • It would be nice to have random tests too ! :)

  • @danarters,

    This kata seems familiar but I couldn't find a duplicate after a quick search. Here are a few suggestions in the mean time!

    • Typo in the description: skippped -> skipped

    • It looks like you accidentally reversed the order of the arguments in the tests. It just messes up the error message {actual} should equal {expected}.

    • (Optional) The Example Test Cases seem a bit over-complicated. You don't really need to shuffle those lists every time they are run. They could be easily simplified:

      test.assert_equals(sort_ranks(
          ['3', '1', '10', '6', '2', '4', '5', '9', '7', '8']),
          ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'])
      test.assert_equals(sort_ranks(
          ['1.1.1.1', '1', '1.1', '1.1.1']), ['1', '1.1', '1.1.1', '1.1.1.1'])
      test.assert_equals(sort_ranks(
          ['2', '1.1', '1', '1.2']), ['1', '1.1', '1.2', '2'])
      
    • (Optional) There is also a fair bit of repetition in your main Test Cases. It could be cleaned up quite easily.

    Thanks!

  • I'm not sure either :/ I just submitted again to make sure and it passed all the tests.

  • Hi,

    You have inverted the expected and actual values in the assertions ! ;)

  • A glitch I think. I did not submit that version anyway.

  • I'm not sure why this is marked as incorrect, I just ran it through the new set of tests and it passes all of them.

    Maybe it is an issue with how codewars handles updated test cases

  • I'm not sure why this is marked as incorrect, I just ran it through the new set of tests and it passes all of them.

    Maybe it is an issue with how codewars handles updated test cases

  • I was having some troubles editing the test cases, I think they are working now though. To the few people who's solutions are now marked invalid with a change in test cases, the example test cases now reflect the actual ones much better.

    The sorting function must be able to handle ranks above 10, which means a simple string sort will incorrectly end up with ['1', '10', '2'...]