今回読んだのは3.3のunittestのソース。 ソースを読む前に以下のドキュメントは確認しておく。 とりあえず以下の4つの概念を知っておくだけで理解が早まると思う。
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Sample Animation</title> | |
<link rel="stylesheet" href="sample.css"/> | |
</head> | |
<body> | |
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
max(text,key=lambda s:s.count) |
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
from datetime import datetime | |
import cProfile | |
import pstats | |
from django.conf import settings | |
class PerfomanceMesuamentMiddleware: | |
""" | |
consoleに実行時間を表示する。 | |
表示条件は以下 |
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
def func(): | |
print("test") |
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
" vimscriptでclassっぽく扱う | |
" dictionaryで頑張る | |
let s:MyClass = {"foo": "foo"} | |
function! s:MyClass.print() dict | |
echo self.foo | |
endfunction | |
" instance作成はcopyで代用 | |
function! s:MyClass.new(text) dict |
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
" File: openbrowser.vim | |
" License: MIT | |
if &cp || (exists("g:loaded_openbrowser_vim") && g:loaded_openbrowser_vim) | |
finish | |
endif | |
function! OpenBrowser() | |
let tmp = @@ | |
silent normal gvy |
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
let s:py_path = join([expand('<sfile>:p:h:h'), "python"], '/') |
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
let g:expectpy_path="PROJECT_DIRECTORY" | |
noremap <leader><C-r> :call RunTest() <CR> | |
function! RunTest() | |
let l:cwd = getcwd() | |
:exec "cd ".g:expectpy_path | |
:!python setup.py test | |
:exec "cd ".l:cwd | |
endfunction |
OlderNewer