EVOLUTION-MANAGER
Edit File: expect_vector.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Does code return a vector with the expected size and/or...</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for expect_vector {testthat}"><tr><td>expect_vector {testthat}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Does code return a vector with the expected size and/or prototype?</h2> <h3>Description</h3> <p><code>expect_vector()</code> is a thin wrapper around <code><a href="../../vctrs/html/vec_assert.html">vctrs::vec_assert()</a></code>, converting the results of that function in to the expectations used by testthat. This means that it used the vctrs of <code>ptype</code> (prototype) and <code>size</code>. See details in <a href="https://vctrs.r-lib.org/articles/type-size.html">https://vctrs.r-lib.org/articles/type-size.html</a> </p> <h3>Usage</h3> <pre> expect_vector(object, ptype = NULL, size = NULL) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>object</code></td> <td> <p>Object to test. </p> <p>Supports limited unquoting to make it easier to generate readable failures within a function or for loop. See <a href="quasi_label.html">quasi_label</a> for more details.</p> </td></tr> <tr valign="top"><td><code>ptype</code></td> <td> <p>(Optional) Vector prototype to test against. Should be a size-0 (empty) generalised vector.</p> </td></tr> <tr valign="top"><td><code>size</code></td> <td> <p>(Optional) Size to check for.</p> </td></tr> </table> <h3>Examples</h3> <pre> if (requireNamespace("vctrs") && packageVersion("vctrs") > "0.1.0.9002") { expect_vector(1:10, ptype = integer(), size = 10) show_failure(expect_vector(1:10, ptype = integer(), size = 5)) show_failure(expect_vector(1:10, ptype = character(), size = 5)) } </pre> <hr /><div style="text-align: center;">[Package <em>testthat</em> version 3.1.5 <a href="00Index.html">Index</a>]</div> </body></html>