MCPcopy Create free account
hub / github.com/astral-sh/ruff / test_is_valid_python_code_cell

Function test_is_valid_python_code_cell

crates/ruff_notebook/src/notebook.rs:606–619  ·  view source on GitHub ↗
(cell: &str, expected: bool)

Source from the content-addressed store, hash-verified

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> {

Callers

nothing calls this directly

Calls 1

OkClass · 0.85

Tested by

no test coverage detected