Skip to content

Instantly share code, notes, and snippets.

View t2y's full-sized avatar

Tetsuya Morimoto t2y

View GitHub Profile
@t2y
t2y / coverage-100
Last active August 29, 2015 14:15
coverage testing
$ 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
@t2y
t2y / iso2022_jp_ms.txt
Created November 24, 2014 05:08
iso-2022-jp-ms test data1
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
===========
@t2y
t2y / gist:4191973
Created December 3, 2012 01:04
python 1 liner for xml pretty print with standard input
$ cat sample.xml | python -c "import sys; from xml.dom.minidom import parse; print parse(sys.stdin).toprettyxml(indent=' ')"
@t2y
t2y / pytest-pep8-output.py
Created September 8, 2012 07:22
"pytest --pep8" command output
$ 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
@t2y
t2y / ugly_sample.py
Created September 8, 2012 07:17
sample program how to use pep8
import sys, os
class A(object): pass
def func(x, y = 2):
return x, y
def main():
@t2y
t2y / conftest.py
Created July 24, 2012 02:43
simple plugin for shelldoctest with pytest, though this script reports only its result
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):