Skip to content

Commit

Permalink
coverage++
Browse files Browse the repository at this point in the history
  • Loading branch information
mhils committed Jun 1, 2023
1 parent 721c13c commit 2ee012c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/conversions/std/ipaddr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ mod test_ipaddr {
"IPv6Address"
};

let pyobj = ip.to_object(py);
let pyobj = ip.into_py(py);
let repr = pyobj.as_ref(py).repr().unwrap().to_string_lossy();
assert_eq!(repr, format!("{}('{}')", py_cls, ip));

Expand All @@ -115,6 +115,9 @@ mod test_ipaddr {
let py_str = PyString::new(py, "0:0:0:0:0:0:0:1");
let ip: IpAddr = py_str.to_object(py).extract(py).unwrap();
assert_eq!(ip, IpAddr::from_str("::1").unwrap());

let py_str = PyString::new(py, "invalid");
assert!(py_str.to_object(py).extract::<IpAddr>(py).is_err());
});
}
}

0 comments on commit 2ee012c

Please sign in to comment.