pub struct PytestNodeId(/* private fields */);Expand description
pytest node ID metadata.
Implementations§
Source§impl PytestNodeId
impl PytestNodeId
Sourcepub fn new(input: &str) -> Result<PytestNodeId, PytestNameError>
pub fn new(input: &str) -> Result<PytestNodeId, PytestNameError>
Creates pytest node ID metadata.
§Errors
Returns PytestNameError::Empty when input is empty after trimming.
Examples found in repository?
examples/basic_usage.rs (line 10)
6fn main() -> Result<(), Box<dyn std::error::Error>> {
7 let version: PythonVersion = "Python 3.12.1".parse()?;
8 let identifier = PythonIdentifier::new("async_task")?;
9 let requirement = PipRequirement::new("requests>=2")?;
10 let node_id = PytestNodeId::new("tests/test_app.py::test_smoke")?;
11
12 assert!(version.is_python3());
13 assert_eq!(identifier.as_str(), "async_task");
14 assert_eq!(PythonImplementation::CPython.as_str(), "cpython");
15 assert_eq!(PythonPrimitiveValue::None.type_name(), "NoneType");
16 assert!(!requirement.is_editable());
17 assert!(node_id.has_scope_separator());
18 Ok(())
19}Sourcepub fn has_scope_separator(&self) -> bool
pub fn has_scope_separator(&self) -> bool
Returns whether the node ID contains a pytest :: separator.
Examples found in repository?
examples/basic_usage.rs (line 17)
6fn main() -> Result<(), Box<dyn std::error::Error>> {
7 let version: PythonVersion = "Python 3.12.1".parse()?;
8 let identifier = PythonIdentifier::new("async_task")?;
9 let requirement = PipRequirement::new("requests>=2")?;
10 let node_id = PytestNodeId::new("tests/test_app.py::test_smoke")?;
11
12 assert!(version.is_python3());
13 assert_eq!(identifier.as_str(), "async_task");
14 assert_eq!(PythonImplementation::CPython.as_str(), "cpython");
15 assert_eq!(PythonPrimitiveValue::None.type_name(), "NoneType");
16 assert!(!requirement.is_editable());
17 assert!(node_id.has_scope_separator());
18 Ok(())
19}Trait Implementations§
Source§impl Clone for PytestNodeId
impl Clone for PytestNodeId
Source§fn clone(&self) -> PytestNodeId
fn clone(&self) -> PytestNodeId
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PytestNodeId
impl Debug for PytestNodeId
Source§impl Display for PytestNodeId
impl Display for PytestNodeId
Source§impl FromStr for PytestNodeId
impl FromStr for PytestNodeId
Source§type Err = PytestNameError
type Err = PytestNameError
The associated error which can be returned from parsing.
Source§fn from_str(input: &str) -> Result<PytestNodeId, <PytestNodeId as FromStr>::Err>
fn from_str(input: &str) -> Result<PytestNodeId, <PytestNodeId as FromStr>::Err>
Parses a string
s to return a value of this type. Read moreSource§impl Hash for PytestNodeId
impl Hash for PytestNodeId
Source§impl Ord for PytestNodeId
impl Ord for PytestNodeId
Source§fn cmp(&self, other: &PytestNodeId) -> Ordering
fn cmp(&self, other: &PytestNodeId) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for PytestNodeId
impl PartialEq for PytestNodeId
Source§fn eq(&self, other: &PytestNodeId) -> bool
fn eq(&self, other: &PytestNodeId) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for PytestNodeId
impl PartialOrd for PytestNodeId
Source§impl TryFrom<&str> for PytestNodeId
impl TryFrom<&str> for PytestNodeId
Source§type Error = PytestNameError
type Error = PytestNameError
The type returned in the event of a conversion error.
Source§fn try_from(
value: &str,
) -> Result<PytestNodeId, <PytestNodeId as TryFrom<&str>>::Error>
fn try_from( value: &str, ) -> Result<PytestNodeId, <PytestNodeId as TryFrom<&str>>::Error>
Performs the conversion.
impl Eq for PytestNodeId
impl StructuralPartialEq for PytestNodeId
Auto Trait Implementations§
impl Freeze for PytestNodeId
impl RefUnwindSafe for PytestNodeId
impl Send for PytestNodeId
impl Sync for PytestNodeId
impl Unpin for PytestNodeId
impl UnsafeUnpin for PytestNodeId
impl UnwindSafe for PytestNodeId
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