Ad
  • Custom User Avatar

    Random test almost always expects [] as result

  • Default User Avatar

    I appreciate the response, no worries on the delay -- I was able to figure out what was going on and adjusted. I hope the exchange will help anyone else who runs into the issue and in general might give a bit more insight into what is being tested and how to structure potential processes.

    I will simply point out (for anyone else who reads this as they are attemping to solve) that the results/expected results print-out of the self.atoms doesn't print-out an atom if it is a hydrogen. A fact that makes sense for all the hydrogens that fill in the molecule at the end (I understand the reasoning to save space), but was a bit confusing as there are some hydrogens that intentionally exist in the molecule through the methods add/chain/mutate -- and those atoms exist in the self.atoms even before closer, but they DON"T return in the print-out of results/expected results.

  • Custom User Avatar

    Hi,

    I didn't get any notification of your first message, sorry...

    The specs, seem sparse, but I think they are actually pretty correct here: the only place where renumbering is talked about is in the unlock method. So if ever you rearrange something in some other places, you're not following the specs.

    Does that clarify the matter?


    edit: could you still extract a concrete (but rather simple) case where your solution was failing because of that?

  • Default User Avatar

    So, I figured out what was happening -- and Im still not sure this is correct, because the instructions are a bit nebulous here. I was reordering the atom.ids upon running the closing method, thereby pushing all hydrogens (even those explicitly added/mutated) to the end during the CLOSING method. The instructions/behaviors are not clear WHEN that shoud happen -- the only statement I found was that during the unlock method, after removal of the hydrogens, "The id numbers of the remaining atoms have to be continuous AGAIN" -- which I read as if they are continuous AGAIN then by definition they should have been continuous BEFORE. But I suppose the atom.ids could have been continuous, but it appears that the output of the check method (which compares the solution object to the test object) doesn't seem to print H atoms (which in theory it could, it doesn't appear apart of the limitations of the atom.object str print. Anyway ....

  • Default User Avatar

    Ive encountered a problem. Ive done well figuring out and working through the various requirements needed to pass. But now Im seeing something strange -- Im almost through the full tests, but I am getting results that tell me I should be getting something else BUT the printout from the expected results has errors(!!) I know, I know, that can't be, look at all the people that have already solved this kata (in Python). But none-the-less I see errors.

    I went through the print-out of the Atoms[] in the expected results and the atom.ids from the expected results HAVE GAPS -- meaning it skips over #88 and then #90 (on one particular example). But the instructions specifically say that the atom.ids should be contiguous. Mine are, and thus they don't match the "expected results".

    At first I thought maybe the two were switched (the labeling on "my results" and the "expected results"), so I went back and fed some non-sense in on mine, and in fact they are in the right order. So why are there gaps in the atom.ids in the "expected results" when the instructions say they should be contiguous ???

    I took screen shots, I can show the print-out -- it seems a bit much to paste here (although I suppose I could). Im not sure whats going on

  • Custom User Avatar

    No, you didn't have to? What you call answers is actually the answer key, and what you call key are the student's answers, and you treat them as such. You switched the names, but you did not switch the meanings.

  • Default User Avatar

    ah yeah re-read -> strange definition of scoring 100% though: getting them all wrong.

    Thanks though

  • Default User Avatar

    In python I had to switch the order of (key, answers) in the solution setup because it doesn't match the order for those two given in the test cases

  • Default User Avatar

    I did not know the order, obviously. I appreciate the info.

    Done

  • Default User Avatar

    I've just noticed that the expected and actual values are switched.

    For PHPUnit, the correct order should be: <assertion>($expected, $actual, $message)

    For example:

    $this->assertEquals( 
        testSolution($n),
        userSolution($n), 
        "Testing with number $n."
    );
    

    You can omit the $message, but it's recommended to include a custom one.

  • Default User Avatar

    python fork

    changes:

    • copy input to user to avoid confusion when user mutates (this is why I am touching it to begin with)
    • remove redundant describes (only contained one it, describe is for grouping)
    • custom formatted error messages to include what the input was
    • replace parts of test generation with equivalent calls to the random module
  • Default User Avatar

    don't mutate the input

  • Default User Avatar

    Can anyone help me with this? I've passed 157 and failed 149 test. One an example from it.
    test_list=[2065, -349, 472, 70, -383, 173, -63, 192, 35, 89, -87, -74, 449, 256, -129, 298, 164, 85, -445, 441, 433, -170, 313, 360, 190, -449, -148, 67, 217, 80, -59, 146, 375, -24, -460, 0]
    I take:
    left=2065
    right=0
    left+right == sum (rest of list)
    2065 + 0 == 2065
    Therefore, must be return [left]+lst+[right]
    BUT it says that right is [-349, 472, 70, -383, 173, -63, 192, 35, 89, -87, -74, 449, 256, -129, 298, 164, 85, -445, 441, 433, -170, 313, 360, 190, -449, -148, 67, 217, 80, -59, 146, 375, -24, -460]
    Thank you)

  • Default User Avatar

    Javascript translation posted

  • Default User Avatar

    Javascript translation posted

  • Loading more items...