Skip to content

Commit

Permalink
Use slice in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
codeguru42 committed Jun 18, 2024
1 parent c4f3d3a commit edd87ab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/types/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use std::str;
/// use pyo3::types::PyBytes;
///
/// # Python::with_gil(|py| {
/// let py_bytes = PyBytes::new_bound(py, b"foo");
/// let py_bytes = PyBytes::new_bound(py, b"foo".as_slice());
/// // via PartialEq<[u8]>
/// assert_eq!(py_bytes, b"foo");
///
Expand Down Expand Up @@ -378,10 +378,10 @@ mod tests {
#[test]
fn test_comparisons() {
Python::with_gil(|py| {
let b = b"hello, world";
let b = b"hello, world".as_slice();
let py_bytes = PyBytes::new_bound(py, b);

assert_eq!(py_bytes, b"hello, world");
assert_eq!(py_bytes, b"hello, world".as_slice());

assert_eq!(py_bytes, b);
assert_eq!(&py_bytes, b);
Expand Down

0 comments on commit edd87ab

Please sign in to comment.