Last active
August 29, 2015 14:24
-
-
Save tomviner/2a37a5e5c9b7966390e1 to your computer and use it in GitHub Desktop.
Hypothesis test_reverse example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[206096504910900498493010377380239941762L, 27, 241, 468, 206096504910900498493010366855655511824L, -340, 206096504910900498493010370573292788646L, 6, -188, 206096504910900498493010365575630902925L] | |
[21895897394889366278002048857818986990125268678994617770323631L, -5, 73453863292979521160722570724395436702110210638363401802874390L, 860083230267801667615814962096447759118030419081884684367195374L, 1208756186641563556189216823181235577582763775470322786885255197L, 563574118372954898036644503963904424109207146483853094148809633L, 20, -1464475540476225476021127290449598226042060199991921137850322312L, -1554085104269531629275069816677895447025824915356256971517138516L, 658781301413442456187105669962066361153531021415203972856482081L, 1421770204015349061297731987862436233014697243702547161097469746L, 1111082349050193290192329277649104120747717126931126127983058755L, -109571337096131499455011271023310218778431969690802066031870575L, -1536409144373002107386864029818511666641780965936236899633623888L, 0, 141373165154706051459374041047239171901393482703021752648984617L, -100200794863677154028266555466064397390401532284350635255206536L, -365910188520172704474640816345480755308955369813672912535891665L, -18, -1108738252878208611757348303176764065522027171124889654195837811L, 916615603020106510985024111431679022094804624906894821558839946L, -412716470508773072931020287720638745447506884766145600729207716L, 1526059935113743100412556027489171627000917670377774549112149381L, 1558079891595449205826890650640901597056160508544475603137715576L, -1569934891839589510842004133464165004102570361015054075456065925L, -172748403261142414305061799307779325891582947412089098425249774L, -990687537561445670605300648659204069174602867682855541811973916L, 172939057067978677694244170224753890200271581675710415099603756L, 39113930044836604749366933208953073885909993048209126665513366L, -144794442355732825891289046825527609527601647634853699676123402L, 1295224301345568422889237001758737160633250962106810675043869779L, -784516588917689964860887031725301801090992173320449751008841635L, 251520814515291922049428406622173320562242905421843357597555165L, -33, 20] | |
False | |
[27, 241, 468, -340, 206096504910900498493010370573292788646L, -188, 206096504910900498493010365575630902925L] | |
[21895897394889366278002048857818986990125268678994617770323631L, -5, 73453863292979521160722570724395436702110210638363401802874390L, 860083230267801667615814962096447759118030419081884684367195374L, 1208756186641563556189216823181235577582763775470322786885255197L, 563574118372954898036644503963904424109207146483853094148809633L, 20, -1464475540476225476021127290449598226042060199991921137850322312L, -1554085104269531629275069816677895447025824915356256971517138516L, 658781301413442456187105669962066361153531021415203972856482081L, 1421770204015349061297731987862436233014697243702547161097469746L, 1111082349050193290192329277649104120747717126931126127983058755L, -109571337096131499455011271023310218778431969690802066031870575L, -1536409144373002107386864029818511666641780965936236899633623888L, 0, 141373165154706051459374041047239171901393482703021752648984617L, -100200794863677154028266555466064397390401532284350635255206536L, -365910188520172704474640816345480755308955369813672912535891665L, -18, -1108738252878208611757348303176764065522027171124889654195837811L, 916615603020106510985024111431679022094804624906894821558839946L, -412716470508773072931020287720638745447506884766145600729207716L, 1526059935113743100412556027489171627000917670377774549112149381L, 1558079891595449205826890650640901597056160508544475603137715576L, -1569934891839589510842004133464165004102570361015054075456065925L, -172748403261142414305061799307779325891582947412089098425249774L, -990687537561445670605300648659204069174602867682855541811973916L, 172939057067978677694244170224753890200271581675710415099603756L, 39113930044836604749366933208953073885909993048209126665513366L, -144794442355732825891289046825527609527601647634853699676123402L, 1295224301345568422889237001758737160633250962106810675043869779L, -784516588917689964860887031725301801090992173320449751008841635L, 251520814515291922049428406622173320562242905421843357597555165L, -33, 20] | |
False | |
[-340, 206096504910900498493010370573292788646L, -188, 206096504910900498493010365575630902925L] | |
[21895897394889366278002048857818986990125268678994617770323631L, -5, 73453863292979521160722570724395436702110210638363401802874390L, 860083230267801667615814962096447759118030419081884684367195374L, 1208756186641563556189216823181235577582763775470322786885255197L, 563574118372954898036644503963904424109207146483853094148809633L, 20, -1464475540476225476021127290449598226042060199991921137850322312L, -1554085104269531629275069816677895447025824915356256971517138516L, 658781301413442456187105669962066361153531021415203972856482081L, 1421770204015349061297731987862436233014697243702547161097469746L, 1111082349050193290192329277649104120747717126931126127983058755L, -109571337096131499455011271023310218778431969690802066031870575L, -1536409144373002107386864029818511666641780965936236899633623888L, 0, 141373165154706051459374041047239171901393482703021752648984617L, -100200794863677154028266555466064397390401532284350635255206536L, -365910188520172704474640816345480755308955369813672912535891665L, -18, -1108738252878208611757348303176764065522027171124889654195837811L, 916615603020106510985024111431679022094804624906894821558839946L, -412716470508773072931020287720638745447506884766145600729207716L, 1526059935113743100412556027489171627000917670377774549112149381L, 1558079891595449205826890650640901597056160508544475603137715576L, -1569934891839589510842004133464165004102570361015054075456065925L, -172748403261142414305061799307779325891582947412089098425249774L, -990687537561445670605300648659204069174602867682855541811973916L, 172939057067978677694244170224753890200271581675710415099603756L, 39113930044836604749366933208953073885909993048209126665513366L, -144794442355732825891289046825527609527601647634853699676123402L, 1295224301345568422889237001758737160633250962106810675043869779L, -784516588917689964860887031725301801090992173320449751008841635L, 251520814515291922049428406622173320562242905421843357597555165L, -33, 20] | |
False | |
[206096504910900498493010370573292788646L, -188, 206096504910900498493010365575630902925L] | |
[21895897394889366278002048857818986990125268678994617770323631L, -5, 73453863292979521160722570724395436702110210638363401802874390L, 860083230267801667615814962096447759118030419081884684367195374L, 1208756186641563556189216823181235577582763775470322786885255197L, 563574118372954898036644503963904424109207146483853094148809633L, 20, -1464475540476225476021127290449598226042060199991921137850322312L, -1554085104269531629275069816677895447025824915356256971517138516L, 658781301413442456187105669962066361153531021415203972856482081L, 1421770204015349061297731987862436233014697243702547161097469746L, 1111082349050193290192329277649104120747717126931126127983058755L, -109571337096131499455011271023310218778431969690802066031870575L, -1536409144373002107386864029818511666641780965936236899633623888L, 0, 141373165154706051459374041047239171901393482703021752648984617L, -100200794863677154028266555466064397390401532284350635255206536L, -365910188520172704474640816345480755308955369813672912535891665L, -18, -1108738252878208611757348303176764065522027171124889654195837811L, 916615603020106510985024111431679022094804624906894821558839946L, -412716470508773072931020287720638745447506884766145600729207716L, 1526059935113743100412556027489171627000917670377774549112149381L, 1558079891595449205826890650640901597056160508544475603137715576L, -1569934891839589510842004133464165004102570361015054075456065925L, -172748403261142414305061799307779325891582947412089098425249774L, -990687537561445670605300648659204069174602867682855541811973916L, 172939057067978677694244170224753890200271581675710415099603756L, 39113930044836604749366933208953073885909993048209126665513366L, -144794442355732825891289046825527609527601647634853699676123402L, 1295224301345568422889237001758737160633250962106810675043869779L, -784516588917689964860887031725301801090992173320449751008841635L, 251520814515291922049428406622173320562242905421843357597555165L, -33, 20] | |
False | |
[206096504910900498493010370573292788646L, -188, -188] | |
[21895897394889366278002048857818986990125268678994617770323631L, -5, 73453863292979521160722570724395436702110210638363401802874390L, 860083230267801667615814962096447759118030419081884684367195374L, 1208756186641563556189216823181235577582763775470322786885255197L, 563574118372954898036644503963904424109207146483853094148809633L, 20, -1464475540476225476021127290449598226042060199991921137850322312L, -1554085104269531629275069816677895447025824915356256971517138516L, 658781301413442456187105669962066361153531021415203972856482081L, 1421770204015349061297731987862436233014697243702547161097469746L, 1111082349050193290192329277649104120747717126931126127983058755L, -109571337096131499455011271023310218778431969690802066031870575L, -1536409144373002107386864029818511666641780965936236899633623888L, 0, 141373165154706051459374041047239171901393482703021752648984617L, -100200794863677154028266555466064397390401532284350635255206536L, -365910188520172704474640816345480755308955369813672912535891665L, -18, -1108738252878208611757348303176764065522027171124889654195837811L, 916615603020106510985024111431679022094804624906894821558839946L, -412716470508773072931020287720638745447506884766145600729207716L, 1526059935113743100412556027489171627000917670377774549112149381L, 1558079891595449205826890650640901597056160508544475603137715576L, -1569934891839589510842004133464165004102570361015054075456065925L, -172748403261142414305061799307779325891582947412089098425249774L, -990687537561445670605300648659204069174602867682855541811973916L, 172939057067978677694244170224753890200271581675710415099603756L, 39113930044836604749366933208953073885909993048209126665513366L, -144794442355732825891289046825527609527601647634853699676123402L, 1295224301345568422889237001758737160633250962106810675043869779L, -784516588917689964860887031725301801090992173320449751008841635L, 251520814515291922049428406622173320562242905421843357597555165L, -33, 20] | |
False | |
[-188, -188] | |
[21895897394889366278002048857818986990125268678994617770323631L, -5, 73453863292979521160722570724395436702110210638363401802874390L, 860083230267801667615814962096447759118030419081884684367195374L, 1208756186641563556189216823181235577582763775470322786885255197L, 563574118372954898036644503963904424109207146483853094148809633L, 20, -1464475540476225476021127290449598226042060199991921137850322312L, -1554085104269531629275069816677895447025824915356256971517138516L, 658781301413442456187105669962066361153531021415203972856482081L, 1421770204015349061297731987862436233014697243702547161097469746L, 1111082349050193290192329277649104120747717126931126127983058755L, -109571337096131499455011271023310218778431969690802066031870575L, -1536409144373002107386864029818511666641780965936236899633623888L, 0, 141373165154706051459374041047239171901393482703021752648984617L, -100200794863677154028266555466064397390401532284350635255206536L, -365910188520172704474640816345480755308955369813672912535891665L, -18, -1108738252878208611757348303176764065522027171124889654195837811L, 916615603020106510985024111431679022094804624906894821558839946L, -412716470508773072931020287720638745447506884766145600729207716L, 1526059935113743100412556027489171627000917670377774549112149381L, 1558079891595449205826890650640901597056160508544475603137715576L, -1569934891839589510842004133464165004102570361015054075456065925L, -172748403261142414305061799307779325891582947412089098425249774L, -990687537561445670605300648659204069174602867682855541811973916L, 172939057067978677694244170224753890200271581675710415099603756L, 39113930044836604749366933208953073885909993048209126665513366L, -144794442355732825891289046825527609527601647634853699676123402L, 1295224301345568422889237001758737160633250962106810675043869779L, -784516588917689964860887031725301801090992173320449751008841635L, 251520814515291922049428406622173320562242905421843357597555165L, -33, 20] | |
False | |
[-188] | |
[21895897394889366278002048857818986990125268678994617770323631L, -5, 73453863292979521160722570724395436702110210638363401802874390L, 860083230267801667615814962096447759118030419081884684367195374L, 1208756186641563556189216823181235577582763775470322786885255197L, 563574118372954898036644503963904424109207146483853094148809633L, 20, -1464475540476225476021127290449598226042060199991921137850322312L, -1554085104269531629275069816677895447025824915356256971517138516L, 658781301413442456187105669962066361153531021415203972856482081L, 1421770204015349061297731987862436233014697243702547161097469746L, 1111082349050193290192329277649104120747717126931126127983058755L, -109571337096131499455011271023310218778431969690802066031870575L, -1536409144373002107386864029818511666641780965936236899633623888L, 0, 141373165154706051459374041047239171901393482703021752648984617L, -100200794863677154028266555466064397390401532284350635255206536L, -365910188520172704474640816345480755308955369813672912535891665L, -18, -1108738252878208611757348303176764065522027171124889654195837811L, 916615603020106510985024111431679022094804624906894821558839946L, -412716470508773072931020287720638745447506884766145600729207716L, 1526059935113743100412556027489171627000917670377774549112149381L, 1558079891595449205826890650640901597056160508544475603137715576L, -1569934891839589510842004133464165004102570361015054075456065925L, -172748403261142414305061799307779325891582947412089098425249774L, -990687537561445670605300648659204069174602867682855541811973916L, 172939057067978677694244170224753890200271581675710415099603756L, 39113930044836604749366933208953073885909993048209126665513366L, -144794442355732825891289046825527609527601647634853699676123402L, 1295224301345568422889237001758737160633250962106810675043869779L, -784516588917689964860887031725301801090992173320449751008841635L, 251520814515291922049428406622173320562242905421843357597555165L, -33, 20] | |
False | |
[0] | |
[21895897394889366278002048857818986990125268678994617770323631L, -5, 73453863292979521160722570724395436702110210638363401802874390L, 860083230267801667615814962096447759118030419081884684367195374L, 1208756186641563556189216823181235577582763775470322786885255197L, 563574118372954898036644503963904424109207146483853094148809633L, 20, -1464475540476225476021127290449598226042060199991921137850322312L, -1554085104269531629275069816677895447025824915356256971517138516L, 658781301413442456187105669962066361153531021415203972856482081L, 1421770204015349061297731987862436233014697243702547161097469746L, 1111082349050193290192329277649104120747717126931126127983058755L, -109571337096131499455011271023310218778431969690802066031870575L, -1536409144373002107386864029818511666641780965936236899633623888L, 0, 141373165154706051459374041047239171901393482703021752648984617L, -100200794863677154028266555466064397390401532284350635255206536L, -365910188520172704474640816345480755308955369813672912535891665L, -18, -1108738252878208611757348303176764065522027171124889654195837811L, 916615603020106510985024111431679022094804624906894821558839946L, -412716470508773072931020287720638745447506884766145600729207716L, 1526059935113743100412556027489171627000917670377774549112149381L, 1558079891595449205826890650640901597056160508544475603137715576L, -1569934891839589510842004133464165004102570361015054075456065925L, -172748403261142414305061799307779325891582947412089098425249774L, -990687537561445670605300648659204069174602867682855541811973916L, 172939057067978677694244170224753890200271581675710415099603756L, 39113930044836604749366933208953073885909993048209126665513366L, -144794442355732825891289046825527609527601647634853699676123402L, 1295224301345568422889237001758737160633250962106810675043869779L, -784516588917689964860887031725301801090992173320449751008841635L, 251520814515291922049428406622173320562242905421843357597555165L, -33, 20] | |
False | |
[0] | |
[21895897394889366278002048857818986990125268678994617770323631L, 73453863292979521160722570724395436702110210638363401802874390L, 860083230267801667615814962096447759118030419081884684367195374L, 20, -1464475540476225476021127290449598226042060199991921137850322312L, 658781301413442456187105669962066361153531021415203972856482081L, 1421770204015349061297731987862436233014697243702547161097469746L, 1111082349050193290192329277649104120747717126931126127983058755L, -109571337096131499455011271023310218778431969690802066031870575L, 0, 141373165154706051459374041047239171901393482703021752648984617L, -365910188520172704474640816345480755308955369813672912535891665L, -18, -1108738252878208611757348303176764065522027171124889654195837811L, -412716470508773072931020287720638745447506884766145600729207716L, 172939057067978677694244170224753890200271581675710415099603756L, 1295224301345568422889237001758737160633250962106810675043869779L, -33, 20] | |
False | |
[0] | |
[73453863292979521160722570724395436702110210638363401802874390L, 860083230267801667615814962096447759118030419081884684367195374L, -1464475540476225476021127290449598226042060199991921137850322312L, 658781301413442456187105669962066361153531021415203972856482081L, 1111082349050193290192329277649104120747717126931126127983058755L, -109571337096131499455011271023310218778431969690802066031870575L, 0, 141373165154706051459374041047239171901393482703021752648984617L, -365910188520172704474640816345480755308955369813672912535891665L, -1108738252878208611757348303176764065522027171124889654195837811L, -412716470508773072931020287720638745447506884766145600729207716L, 172939057067978677694244170224753890200271581675710415099603756L, 20] | |
False | |
[0] | |
[73453863292979521160722570724395436702110210638363401802874390L, 658781301413442456187105669962066361153531021415203972856482081L, 1111082349050193290192329277649104120747717126931126127983058755L, 141373165154706051459374041047239171901393482703021752648984617L, -1108738252878208611757348303176764065522027171124889654195837811L, -412716470508773072931020287720638745447506884766145600729207716L, 172939057067978677694244170224753890200271581675710415099603756L, 20] | |
False | |
[0] | |
[-1108738252878208611757348303176764065522027171124889654195837811L, -412716470508773072931020287720638745447506884766145600729207716L] | |
False | |
[0] | |
[-412716470508773072931020287720638745447506884766145600729207716L] | |
False | |
[0] | |
[-1] | |
False | |
[0] | |
[0] | |
True | |
[0] | |
[1] | |
False | |
[] | |
[1] | |
True | |
[0] | |
[] | |
True | |
[0] | |
[1] | |
False | |
------------------------------------------------------------------- Hypothesis -------------------------------------------------------------------- | |
Falsifying example: test_reverse(xs=[0], ys=[1]) | |
============================================================ 1 failed in 0.12 seconds ============================================================= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from hypothesis import given | |
import hypothesis.strategies as st | |
def reverse(ls): | |
return list(reversed(ls)) | |
@given( | |
st.lists(st.integers()), | |
st.lists(st.integers()), | |
) | |
def test_reverse(xs, ys): | |
""" | |
prop_revapp :: [Int] -> [Int] -> Bool | |
prop_revapp xs ys = reverse (xs++ys) == reverse xs ++ reverse ys | |
""" | |
print xs | |
print ys | |
print reverse(xs + ys) == reverse(xs) + reverse(ys) | |
assert reverse(xs + ys) == reverse(xs) + reverse(ys) | |
if __name__ == '__main__': | |
# main = quickCheck prop_revapp | |
test_reverse() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment