<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Hypothesis on Hillel Wayne</title>
    <link>https://www.hillelwayne.com/tags/hypothesis/</link>
    <description>Recent content in Hypothesis on Hillel Wayne</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Fri, 19 Jun 2020 00:00:00 +0000</lastBuildDate>
    
	<atom:link href="https://www.hillelwayne.com/tags/hypothesis/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>Property Testing with Complex Inputs</title>
      <link>https://www.hillelwayne.com/post/property-testing-complex-inputs/</link>
      <pubDate>Fri, 19 Jun 2020 00:00:00 +0000</pubDate>
      
      <guid>https://www.hillelwayne.com/post/property-testing-complex-inputs/</guid>
      <description>This was originally written as a tutorial for Hypothesis and will eventually be reproduced there, but it might still be useful for people using other property-testing libraries. This essay assumes some familiarity with Hypothesis. If you haven&amp;rsquo;t used it, a better introduction is here.
Once you learn the basics, there are two hard parts to writing property-based tests:
 What are good properties to test? How do I generate complex inputs?</description>
    </item>
    
    <item>
      <title>Finding Property Tests</title>
      <link>https://www.hillelwayne.com/post/contract-examples/</link>
      <pubDate>Mon, 08 Apr 2019 00:00:00 +0000</pubDate>
      
      <guid>https://www.hillelwayne.com/post/contract-examples/</guid>
      <description>A while back I was ranting about APLs and included this python code to get the mode of a list:
def mode(l): max = None count = {} for x in l: if x not in count: count[x] = 0 count[x] += 1 if not max or count[x] &amp;gt; count[max]: max = x return max  There&amp;rsquo;s a bug in it. Do you see it? If not, try running it on the list [0, 0, 1]:</description>
    </item>
    
    <item>
      <title>Property Tests &#43; Contracts = Integration Tests</title>
      <link>https://www.hillelwayne.com/post/pbt-contracts/</link>
      <pubDate>Sun, 17 Dec 2017 00:00:00 +0000</pubDate>
      
      <guid>https://www.hillelwayne.com/post/pbt-contracts/</guid>
      <description>I&amp;rsquo;m a pretty big fan of contracts and property-based testing. While they&amp;rsquo;re both powerful, they do have tradeoffs:
 Contracts are simple and allow for complex conditionals, but you need to test them over a wide space to confirm them. Property-Based Testing can test your code over a very wide search space, but you have to come up with good generators and invariants.  Maybe they complement each other: &amp;ldquo;your code doesn&amp;rsquo;t violate any contracts&amp;rdquo; counts as a PBT invariant.</description>
    </item>
    
    <item>
      <title>Hypothesis Testing with Oracle Functions</title>
      <link>https://www.hillelwayne.com/post/hypothesis-oracles/</link>
      <pubDate>Fri, 21 Jul 2017 09:00:00 -0500</pubDate>
      
      <guid>https://www.hillelwayne.com/post/hypothesis-oracles/</guid>
      <description>This post is about the Hypothesis testing library. If you&amp;rsquo;re unfamiliar with it, check it out! Property tests are a fantastic addition to your testing suite. All examples use pytest.
Imagine we&amp;rsquo;ve written a bubblesort:
def bubblesort(l: List[int]) -&amp;gt; List[int]: # blah blah blah  What are some of the properties we could test? We could check that the input has the same length as the output:
from hypothesis import given from hypothesis.</description>
    </item>
    
  </channel>
</rss>