| 604 | #[test_case("vscode_language_id_python", true)] |
| 605 | #[test_case("vscode_language_id_javascript", false)] |
| 606 | fn test_is_valid_python_code_cell(cell: &str, expected: bool) -> Result<()> { |
| 607 | /// Read a Jupyter cell from the `resources/test/fixtures/jupyter/cell` directory. |
| 608 | fn read_jupyter_cell(path: impl AsRef<Path>) -> Result<Cell> { |
| 609 | let path = notebook_path("cell").join(path); |
| 610 | let source_code = std::fs::read_to_string(path)?; |
| 611 | Ok(serde_json::from_str(&source_code)?) |
| 612 | } |
| 613 | |
| 614 | assert_eq!( |
| 615 | read_jupyter_cell(format!("{cell}.json"))?.is_valid_python_code_cell(), |
| 616 | expected |
| 617 | ); |
| 618 | Ok(()) |
| 619 | } |
| 620 | |
| 621 | #[test] |
| 622 | fn test_concat_notebook() -> Result<(), NotebookError> { |