Skip to content

Commit

Permalink
Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jeertmans committed Jul 13, 2022
1 parent d3c2af1 commit 433bdd8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/types/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,19 @@ mod tests {
assert!(<PySequence as PyTryFrom>::try_from(v.to_object(py).as_ref(py)).is_ok());
});
}

#[test]
fn test_strings_cannot_be_extracted_to_vec() {
Python::with_gil(|py| {
let v = "London Calling";
let ob = v.to_object(py);

assert!(ob.extract::<Vec<&str>>(py).is_err());
assert!(ob.extract::<Vec<String>>(py).is_err());
assert!(ob.extract::<Vec<char>>(py).is_err());
});
}

#[test]
fn test_seq_empty() {
Python::with_gil(|py| {
Expand Down

0 comments on commit 433bdd8

Please sign in to comment.