blob: d353f72f83d15b918d71529e9b9e652db6a1029b [file] [log] [blame]
<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>apache_beam.dataframe.doctests module &mdash; Apache Beam 2.67.0 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=b86133f3" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />
<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=959b4fbe"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="apache_beam.dataframe.expressions module" href="apache_beam.dataframe.expressions.html" />
<link rel="prev" title="apache_beam.dataframe.convert module" href="apache_beam.dataframe.convert.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home">
Apache Beam
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="apache_beam.coders.html">apache_beam.coders package</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="apache_beam.dataframe.html">apache_beam.dataframe package</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="apache_beam.dataframe.html#submodules">Submodules</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="apache_beam.dataframe.convert.html">apache_beam.dataframe.convert module</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">apache_beam.dataframe.doctests module</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#apache_beam.dataframe.doctests.FakePandasObject"><code class="docutils literal notranslate"><span class="pre">FakePandasObject</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#apache_beam.dataframe.doctests.TestEnvironment"><code class="docutils literal notranslate"><span class="pre">TestEnvironment</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#apache_beam.dataframe.doctests.BeamDataframeDoctestRunner"><code class="docutils literal notranslate"><span class="pre">BeamDataframeDoctestRunner</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#apache_beam.dataframe.doctests.AugmentedTestResults"><code class="docutils literal notranslate"><span class="pre">AugmentedTestResults</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#apache_beam.dataframe.doctests.Summary"><code class="docutils literal notranslate"><span class="pre">Summary</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#apache_beam.dataframe.doctests.parse_rst_ipython_tests"><code class="docutils literal notranslate"><span class="pre">parse_rst_ipython_tests()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#apache_beam.dataframe.doctests.test_rst_ipython"><code class="docutils literal notranslate"><span class="pre">test_rst_ipython()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#apache_beam.dataframe.doctests.teststring"><code class="docutils literal notranslate"><span class="pre">teststring()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#apache_beam.dataframe.doctests.teststrings"><code class="docutils literal notranslate"><span class="pre">teststrings()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#apache_beam.dataframe.doctests.set_pandas_options"><code class="docutils literal notranslate"><span class="pre">set_pandas_options()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#apache_beam.dataframe.doctests.with_run_patched_docstring"><code class="docutils literal notranslate"><span class="pre">with_run_patched_docstring()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#apache_beam.dataframe.doctests.testfile"><code class="docutils literal notranslate"><span class="pre">testfile()</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="#apache_beam.dataframe.doctests.testmod"><code class="docutils literal notranslate"><span class="pre">testmod()</span></code></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.dataframe.expressions.html">apache_beam.dataframe.expressions module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.dataframe.frame_base.html">apache_beam.dataframe.frame_base module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.dataframe.frames.html">apache_beam.dataframe.frames module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.dataframe.io.html">apache_beam.dataframe.io module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.dataframe.pandas_top_level_functions.html">apache_beam.dataframe.pandas_top_level_functions module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.dataframe.partitionings.html">apache_beam.dataframe.partitionings module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.dataframe.schemas.html">apache_beam.dataframe.schemas module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.dataframe.transforms.html">apache_beam.dataframe.transforms module</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.io.html">apache_beam.io package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.metrics.html">apache_beam.metrics package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.ml.html">apache_beam.ml package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.options.html">apache_beam.options package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.portability.html">apache_beam.portability package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.runners.html">apache_beam.runners package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.testing.html">apache_beam.testing package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.transforms.html">apache_beam.transforms package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.typehints.html">apache_beam.typehints package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.utils.html">apache_beam.utils package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.yaml.html">apache_beam.yaml package</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.error.html">apache_beam.error module</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.pipeline.html">apache_beam.pipeline module</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.pvalue.html">apache_beam.pvalue module</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Apache Beam</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item"><a href="apache_beam.dataframe.html">apache_beam.dataframe package</a></li>
<li class="breadcrumb-item active">apache_beam.dataframe.doctests module</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/apache_beam.dataframe.doctests.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="module-apache_beam.dataframe.doctests">
<span id="apache-beam-dataframe-doctests-module"></span><h1>apache_beam.dataframe.doctests module<a class="headerlink" href="#module-apache_beam.dataframe.doctests" title="Link to this heading"></a></h1>
<p>A module that allows running existing pandas doctests with Beam dataframes.</p>
<p>This module hooks into the doctesting framework by providing a custom
runner and, in particular, an OutputChecker, as well as providing a fake
object for mocking out the pandas module.</p>
<p>The (novel) sequence of events when running a doctest is as follows.</p>
<blockquote>
<div><ol class="arabic simple">
<li><p>The test invokes <cite>pd.DataFrame(…)</cite> (or similar) and an actual dataframe
is computed and stashed but a Beam deferred dataframe is returned
in its place.</p></li>
<li><p>Computations are done on these “dataframes,” resulting in new objects,
but as these are actually deferred, only expression trees are built.
In the background, a mapping of id -&gt; deferred dataframe is stored for
each newly created dataframe.</p></li>
<li><p>When any dataframe is printed out, the repr has been overwritten to
print <cite>Dataframe[id]</cite>. The aforementened mapping is used to map this back
to the actual dataframe object, which is then computed via Beam, and its
the (stringified) result plugged into the actual output for comparison.</p></li>
<li><p>The comparison is then done on the sorted lines of the expected and actual
values.</p></li>
</ol>
</div></blockquote>
<dl class="py class">
<dt class="sig sig-object py" id="apache_beam.dataframe.doctests.FakePandasObject">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">apache_beam.dataframe.doctests.</span></span><span class="sig-name descname"><span class="pre">FakePandasObject</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">pandas_obj</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">test_env</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/dataframe/doctests.html#FakePandasObject"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.dataframe.doctests.FakePandasObject" title="Link to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.13)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>A stand-in for the wrapped pandas objects.</p>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="apache_beam.dataframe.doctests.TestEnvironment">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">apache_beam.dataframe.doctests.</span></span><span class="sig-name descname"><span class="pre">TestEnvironment</span></span><a class="reference internal" href="_modules/apache_beam/dataframe/doctests.html#TestEnvironment"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.dataframe.doctests.TestEnvironment" title="Link to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.13)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>A class managing the patching (of methods, inputs, and outputs) needed
to run and validate tests.</p>
<p>These classes are patched to be able to recognize and retrieve inputs
and results, stored in <cite>self._inputs</cite> and <cite>self._all_frames</cite> respectively.</p>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.dataframe.doctests.TestEnvironment.fake_pandas_module">
<span class="sig-name descname"><span class="pre">fake_pandas_module</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/dataframe/doctests.html#TestEnvironment.fake_pandas_module"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.dataframe.doctests.TestEnvironment.fake_pandas_module" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.dataframe.doctests.TestEnvironment.context">
<span class="sig-name descname"><span class="pre">context</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/dataframe/doctests.html#TestEnvironment.context"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.dataframe.doctests.TestEnvironment.context" title="Link to this definition"></a></dt>
<dd><p>Creates a context within which DeferredBase types are monkey patched
to record ids.</p>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="apache_beam.dataframe.doctests.BeamDataframeDoctestRunner">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">apache_beam.dataframe.doctests.</span></span><span class="sig-name descname"><span class="pre">BeamDataframeDoctestRunner</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">env</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">use_beam</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">wont_implement_ok</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">not_implemented_ok</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">skip</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/dataframe/doctests.html#BeamDataframeDoctestRunner"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.dataframe.doctests.BeamDataframeDoctestRunner" title="Link to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/doctest.html#doctest.DocTestRunner" title="(in Python v3.13)"><code class="xref py py-class docutils literal notranslate"><span class="pre">DocTestRunner</span></code></a></p>
<p>A Doctest runner suitable for replacing the <cite>pd</cite> module with one backed
by beam.</p>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.dataframe.doctests.BeamDataframeDoctestRunner.run">
<span class="sig-name descname"><span class="pre">run</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">test</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/dataframe/doctests.html#BeamDataframeDoctestRunner.run"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.dataframe.doctests.BeamDataframeDoctestRunner.run" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.dataframe.doctests.BeamDataframeDoctestRunner.report_success">
<span class="sig-name descname"><span class="pre">report_success</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">out</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">test</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">example</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">got</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/dataframe/doctests.html#BeamDataframeDoctestRunner.report_success"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.dataframe.doctests.BeamDataframeDoctestRunner.report_success" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.dataframe.doctests.BeamDataframeDoctestRunner.fake_pandas_module">
<span class="sig-name descname"><span class="pre">fake_pandas_module</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/dataframe/doctests.html#BeamDataframeDoctestRunner.fake_pandas_module"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.dataframe.doctests.BeamDataframeDoctestRunner.fake_pandas_module" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.dataframe.doctests.BeamDataframeDoctestRunner.summarize">
<span class="sig-name descname"><span class="pre">summarize</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/dataframe/doctests.html#BeamDataframeDoctestRunner.summarize"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.dataframe.doctests.BeamDataframeDoctestRunner.summarize" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.dataframe.doctests.BeamDataframeDoctestRunner.summary">
<span class="sig-name descname"><span class="pre">summary</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/dataframe/doctests.html#BeamDataframeDoctestRunner.summary"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.dataframe.doctests.BeamDataframeDoctestRunner.summary" title="Link to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="apache_beam.dataframe.doctests.AugmentedTestResults">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">apache_beam.dataframe.doctests.</span></span><span class="sig-name descname"><span class="pre">AugmentedTestResults</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">failed</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">attempted</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/dataframe/doctests.html#AugmentedTestResults"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.dataframe.doctests.AugmentedTestResults" title="Link to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/doctest.html#doctest.TestResults" title="(in Python v3.13)"><code class="xref py py-class docutils literal notranslate"><span class="pre">TestResults</span></code></a></p>
<p>Create new instance of TestResults(failed, attempted)</p>
</dd></dl>
<dl class="py class">
<dt class="sig sig-object py" id="apache_beam.dataframe.doctests.Summary">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">apache_beam.dataframe.doctests.</span></span><span class="sig-name descname"><span class="pre">Summary</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">failures</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tries</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">skipped</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">error_reasons</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/dataframe/doctests.html#Summary"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.dataframe.doctests.Summary" title="Link to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.13)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.dataframe.doctests.Summary.result">
<span class="sig-name descname"><span class="pre">result</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/dataframe/doctests.html#Summary.result"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.dataframe.doctests.Summary.result" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="apache_beam.dataframe.doctests.Summary.summarize">
<span class="sig-name descname"><span class="pre">summarize</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/dataframe/doctests.html#Summary.summarize"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.dataframe.doctests.Summary.summarize" title="Link to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="apache_beam.dataframe.doctests.parse_rst_ipython_tests">
<span class="sig-prename descclassname"><span class="pre">apache_beam.dataframe.doctests.</span></span><span class="sig-name descname"><span class="pre">parse_rst_ipython_tests</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rst</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">extraglobs</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">optionflags</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/dataframe/doctests.html#parse_rst_ipython_tests"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.dataframe.doctests.parse_rst_ipython_tests" title="Link to this definition"></a></dt>
<dd><p>Extracts examples from an rst file and produce a test suite by running
them through pandas to get the expected outputs.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="apache_beam.dataframe.doctests.test_rst_ipython">
<span class="sig-prename descclassname"><span class="pre">apache_beam.dataframe.doctests.</span></span><span class="sig-name descname"><span class="pre">test_rst_ipython</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">rst</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">report</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">wont_implement_ok</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">()</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">not_implemented_ok</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">()</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">skip</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">()</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/dataframe/doctests.html#test_rst_ipython"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.dataframe.doctests.test_rst_ipython" title="Link to this definition"></a></dt>
<dd><p>Extracts examples from an rst file and run them through pandas to get the
expected output, and then compare them against our dataframe implementation.</p>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="apache_beam.dataframe.doctests.teststring">
<span class="sig-prename descclassname"><span class="pre">apache_beam.dataframe.doctests.</span></span><span class="sig-name descname"><span class="pre">teststring</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">text</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">wont_implement_ok</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">not_implemented_ok</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/dataframe/doctests.html#teststring"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.dataframe.doctests.teststring" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="apache_beam.dataframe.doctests.teststrings">
<span class="sig-prename descclassname"><span class="pre">apache_beam.dataframe.doctests.</span></span><span class="sig-name descname"><span class="pre">teststrings</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">texts</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">report</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">runner_kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/dataframe/doctests.html#teststrings"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.dataframe.doctests.teststrings" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="apache_beam.dataframe.doctests.set_pandas_options">
<span class="sig-prename descclassname"><span class="pre">apache_beam.dataframe.doctests.</span></span><span class="sig-name descname"><span class="pre">set_pandas_options</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/dataframe/doctests.html#set_pandas_options"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.dataframe.doctests.set_pandas_options" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="apache_beam.dataframe.doctests.with_run_patched_docstring">
<span class="sig-prename descclassname"><span class="pre">apache_beam.dataframe.doctests.</span></span><span class="sig-name descname"><span class="pre">with_run_patched_docstring</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">target</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/dataframe/doctests.html#with_run_patched_docstring"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.dataframe.doctests.with_run_patched_docstring" title="Link to this definition"></a></dt>
<dd></dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="apache_beam.dataframe.doctests.testfile">
<span class="sig-prename descclassname"><span class="pre">apache_beam.dataframe.doctests.</span></span><span class="sig-name descname"><span class="pre">testfile</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/dataframe/doctests.html#testfile"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.dataframe.doctests.testfile" title="Link to this definition"></a></dt>
<dd><p>Run all pandas doctests in the specified file.</p>
<p>Arguments <cite>skip</cite>, <cite>wont_implement_ok</cite>, <cite>not_implemented_ok</cite> are all in the
format:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
<span class="s2">&quot;module.Class.method&quot;</span><span class="p">:</span> <span class="p">[</span><span class="s1">&#39;*&#39;</span><span class="p">],</span>
<span class="s2">&quot;module.Class.other_method&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="s1">&#39;instance.other_method(bad_input)&#39;</span><span class="p">,</span>
<span class="s1">&#39;observe_result_of_bad_input()&#39;</span><span class="p">,</span>
<span class="p">],</span>
<span class="p">}</span>
</pre></div>
</div>
<p><cite>‘*’</cite> indicates all examples should be matched, otherwise the list is a list
of specific input strings that should be matched.</p>
<p>All arguments are kwargs.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>optionflags</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – Passed through to doctests.</p></li>
<li><p><strong>extraglobs</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.13)"><em>dict</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>,</em><em>Any</em><em>]</em>) – Passed through to doctests.</p></li>
<li><p><strong>use_beam</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.13)"><em>bool</em></a>) – If true, run a Beam pipeline with partitioned input to
verify the examples, else use PartitioningSession to simulate
distributed execution.</p></li>
<li><p><strong>skip</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.13)"><em>dict</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>,</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>]</em>) – A set of examples to skip entirely.
If a key is ‘*’, an example will be skipped in all test scenarios.</p></li>
<li><p><strong>wont_implement_ok</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.13)"><em>dict</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>,</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>]</em>) – A set of examples that are allowed to
raise WontImplementError.</p></li>
<li><p><strong>not_implemented_ok</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.13)"><em>dict</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>,</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>]</em>) – A set of examples that are allowed to
raise NotImplementedError.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>A doctest result describing the passed/failed tests.</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/doctest.html#doctest.TestResults" title="(in Python v3.13)"><em>TestResults</em></a></p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt class="sig sig-object py" id="apache_beam.dataframe.doctests.testmod">
<span class="sig-prename descclassname"><span class="pre">apache_beam.dataframe.doctests.</span></span><span class="sig-name descname"><span class="pre">testmod</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">args</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/dataframe/doctests.html#testmod"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#apache_beam.dataframe.doctests.testmod" title="Link to this definition"></a></dt>
<dd><p>Run all pandas doctests in the specified module.</p>
<p>Arguments <cite>skip</cite>, <cite>wont_implement_ok</cite>, <cite>not_implemented_ok</cite> are all in the
format:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
<span class="s2">&quot;module.Class.method&quot;</span><span class="p">:</span> <span class="p">[</span><span class="s1">&#39;*&#39;</span><span class="p">],</span>
<span class="s2">&quot;module.Class.other_method&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="s1">&#39;instance.other_method(bad_input)&#39;</span><span class="p">,</span>
<span class="s1">&#39;observe_result_of_bad_input()&#39;</span><span class="p">,</span>
<span class="p">],</span>
<span class="p">}</span>
</pre></div>
</div>
<p><cite>‘*’</cite> indicates all examples should be matched, otherwise the list is a list
of specific input strings that should be matched.</p>
<p>All arguments are kwargs.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>optionflags</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.13)"><em>int</em></a>) – Passed through to doctests.</p></li>
<li><p><strong>extraglobs</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.13)"><em>dict</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>,</em><em>Any</em><em>]</em>) – Passed through to doctests.</p></li>
<li><p><strong>use_beam</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.13)"><em>bool</em></a>) – If true, run a Beam pipeline with partitioned input to
verify the examples, else use PartitioningSession to simulate
distributed execution.</p></li>
<li><p><strong>skip</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.13)"><em>dict</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>,</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>]</em>) – A set of examples to skip entirely.
If a key is ‘*’, an example will be skipped in all test scenarios.</p></li>
<li><p><strong>wont_implement_ok</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.13)"><em>dict</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>,</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>]</em>) – A set of examples that are allowed to
raise WontImplementError.</p></li>
<li><p><strong>not_implemented_ok</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.13)"><em>dict</em></a><em>[</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>,</em><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a><em>]</em>) – A set of examples that are allowed to
raise NotImplementedError.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>A doctest result describing the passed/failed tests.</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/doctest.html#doctest.TestResults" title="(in Python v3.13)"><em>TestResults</em></a></p>
</dd>
</dl>
</dd></dl>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="apache_beam.dataframe.convert.html" class="btn btn-neutral float-left" title="apache_beam.dataframe.convert module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="apache_beam.dataframe.expressions.html" class="btn btn-neutral float-right" title="apache_beam.dataframe.expressions module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright %Y, Apache Beam.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>