pub struct DocTestParser { /* private fields */ }Expand description
Parser for extracting Python doctests from source files.
Implementations§
Source§impl DocTestParser
impl DocTestParser
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new parser.
§Panics
Panics if regex compilation fails (should never happen with valid patterns).
Sourcepub fn parse_source(&self, source: &str, module: &str) -> Vec<DocTest>
pub fn parse_source(&self, source: &str, module: &str) -> Vec<DocTest>
Extract doctests from a Python source string.
§Arguments
source- Python source codemodule- Module name for the extracted doctests
Sourcepub fn parse_file(&self, path: &Path, module: &str) -> Result<Vec<DocTest>>
pub fn parse_file(&self, path: &Path, module: &str) -> Result<Vec<DocTest>>
Extract doctests from a Python file.
Sourcepub fn parse_directory(
&self,
dir: &Path,
source: &str,
version: &str,
) -> Result<DocTestCorpus>
pub fn parse_directory( &self, dir: &Path, source: &str, version: &str, ) -> Result<DocTestCorpus>
Extract doctests from a directory of Python files.
§Arguments
dir- Directory to scan for .py filessource- Source identifier (e.g., “cpython”)version- Version string or git SHA
Trait Implementations§
Source§impl Debug for DocTestParser
impl Debug for DocTestParser
Auto Trait Implementations§
impl Freeze for DocTestParser
impl RefUnwindSafe for DocTestParser
impl Send for DocTestParser
impl Sync for DocTestParser
impl Unpin for DocTestParser
impl UnsafeUnpin for DocTestParser
impl UnwindSafe for DocTestParser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.