-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert dualmode_insertcell.js #3508
Convert dualmode_insertcell.js #3508
Conversation
👍 are you waiting for anything from us? |
No, I'm sorry I just got busy with a little task at work. I'll start working on notebook once I'm done with it I promise it will be soon). Thanks for checking in :) |
@takluyver I have a question
|
The first chunk is a simple test for inserting a cell above and below the current one, though it doesn't look like it's a very good test. The second part is testing with multiple cells selected, to check that the new cell is added in the right place - before the first selected cell, or after the last selected cell. |
So just to make sure I understand the purpose of the test correctly and not just copy it from js to python:
|
I think it's only dealing with command mode. IIRC, all the |
…de and also after editing cells in edit mode
notebook.current_cell.send_keys("a") | ||
assert notebook.get_cell_type(3) == "markdown" | ||
notebook.current_cell.send_keys("b") | ||
assert notebook.get_cell_type(4) == "markdown" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the thing this is trying to test no longer works like that. We used to insert a new cell of the same type as the one you had selected, but we eventually decided it was easier to follow if it was always a code cell that was inserted. The test passes, but I think that's two accidents cancelling each other out - the cell you converted to markdown becomes number 3, then number 4, as you insert other cells.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh .. okay. I will remove those steps and assertions then. Do you have any other comments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was actually confused about that. I tried to do the test manually and I wasn't able to insert markdown cells. It all makes sense now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I deeply apologize for the delay in submitting this PR. I will do my best to make sure this doesn't happen again and I hope this doesn't affect your idea of how committed I am to the team and the project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to apologise! Everyone gets busy at times, and no-one expects volunteer contributors to do things by any set deadline. We might ping you on unfinished pull requests in case you've forgotten about it, or in case you're waiting for us to answer something, but if you don't have time to work on it, that's fine. If it's urgent, someone else can pick it up and finish it, and if not, it can wait. :-)
I'm a bit too tired for a detailed review now, but I think it's still missing the tests from the JS version which check inserting a cell when multiple cells are already selected? Once you're happy that you've made Python equivalents of the JS tests, feel free to go ahead and delete the JS file in this PR. |
assert notebook.get_cell_contents(1) == "" | ||
assert notebook.get_cell_contents(2) == "cell1" | ||
assert notebook.get_cell_contents(3) == "cell2" | ||
assert notebook.get_cell_contents(4) == "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For something like this, I think it would be an improvement to get all the cells at once:
assert notebook.get_cells_contents()[:4] == ["", "cell1", "cell2", ""]
If the test fails, I think the comparison of the lists will give a more informative error to see what has gone wrong. It's also shorter and I guess it's more efficient (less requests to the browser).
… less requests to the browser
Thanks! |
This PR is addressing issue #3335 in order to convert js tests to selenium. It contains the conversion of the file
notebook/tests/notebook/dualmode_insertcell.js