This file contains 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
import pytest | |
import shelldoctest | |
# use this if you run only shelldoctest | |
#def pytest_addoption(parser): | |
# parser.addoption("--shelldoctest", action="store_true", | |
# help="run shell-doctest") | |
# | |
#def pytest_runtest_setup(item): | |
# if not isinstance(item, item.Function): |
This file contains 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
import sys, os | |
class A(object): pass | |
def func(x, y = 2): | |
return x, y | |
def main(): |
This file contains 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
$ py.test --pep8 ugly_sample.py | |
============================= test session starts ============================== | |
platform darwin -- Python 2.7.3 -- pytest-2.2.4 | |
collected 1 items | |
ugly_sample.py F | |
=================================== FAILURES =================================== | |
__________________________________ PEP8-check __________________________________ | |
/private/tmp/ugly_sample.py:6:11: E401 multiple imports on one line |
This file contains 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
$ cat sample.xml | python -c "import sys; from xml.dom.minidom import parse; print parse(sys.stdin).toprettyxml(indent=' ')" |
This file contains 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
Python $B$N3+H/$O!"(B1990 $BG/$4$m$+$i3+;O$5$l$F$$$^$9!#(B | |
$B3+H/<T$N(B Guido van Rossum $B$O650iMQ$N%W%m%0%i%_%s%08@8l!V(BABC$B!W$N3+H/$K;22C$7$F$$$^$7$?$,!"(BABC $B$O<BMQ>e$NL\E*$K$O$"$^$jE,$7$F$$$^$;$s$G$7$?!#(B | |
$B$3$N$?$a!"(BGuido $B$O$h$j<BMQE*$J%W%m%0%i%_%s%08@8l$N3+H/$r3+;O$7!"1Q9q(B BBS $BJ|Aw$N%3%a%G%#HVAH!V%b%s%F%#(B $B%Q%$%=%s!W$N%U%!%s$G$"$k(B Guido $B$O$3$N8@8l$r!V(BPython$B!W$HL>$E$1(B | |
$B$^$7$?!#(B | |
$B$3$N$h$&$JGX7J$+$i@8$^$l$?(B Python $B$N8@8l@_7W$O!"!V%7%s%W%k!W$G!V=,F@$,MF0W!W$H$$$&L\I8$K=EE@$,CV$+$l$F$$$^$9!#(B | |
$BB?$/$N%9%/%j%W%H7O8@8l$G$O%f!<%6$NL\@h$NMxJX@-$rM%@h$7$F?'!9$J5!G=$r8@8lMWAG$H$7$F<h$jF~$l$k>l9g$,B?$$$N$G$9$,!"(BPython $B$G$O$=$&$$$C$?>.:Y9)$,DI2C$5$l$k$3$H$O$"$^$j$"$j$^$;$s!#(B | |
$B8@8l<+BN$N5!G=$O:G>.8B$K2!$5$(!"I,MW$J5!G=$O3HD%%b%8%e!<%k$H$7$FDI2C$9$k!"$H$$$&$N$,(B Python $B$N%]%j%7!<$G$9!#(B | |
NEC$BFC<lJ8;z(B | |
=========== |
This file contains 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
$ coverage run t1.py | |
$ coverage report -m --fail-under 100 | |
Name Stmts Miss Cover Missing | |
------------------------------------- | |
t1 7 0 100% | |
$ echo $? | |
0 | |
$ coverage run t2.py | |
$ coverage report -m --fail-under 100 |
This file contains 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
# -*- coding: utf-8 -*- | |
""" | |
implement Producer-Consumer pattern using asyncio | |
http://www.hyuki.com/dp/dpinfo.html#ProducerConsumer | |
""" | |
import asyncio | |
from random import choice | |
This file contains 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
# -*- coding: utf-8 -*- | |
""" | |
pep492 aiter using queue before pep 525 | |
https://www.python.org/dev/peps/pep-0492 | |
https://www.python.org/dev/peps/pep-0525 | |
""" | |
import asyncio | |
This file contains 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
# -*- coding: utf-8 -*- | |
""" | |
pep 530 -- asynchronous comprehensions | |
https://www.python.org/dev/peps/pep-0530 | |
""" | |
import asyncio | |
from random import choice | |
This file contains 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
package main | |
import ( | |
"fmt" | |
_ "github.com/mattn/go-sqlite3" | |
"github.com/naoina/genmai" | |
) | |
type testData struct { |
OlderNewer