pelican==3.3 Markdown pelican-extended-sitemap==1.0.0
sudo pip install virtualenvwrapper
def test_equality(): assert True == False
(test)jhaddad@jons-mac-pro ~VIRTUAL_ENV/src$ nosetests F ====================================================================== FAIL: test_nose_example.test_equality ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/jhaddad/.virtualenvs/test/lib/python2.7/site-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/Users/jhaddad/.virtualenvs/test/src/test_nose_example.py", line 3, in test_equality assert True == False AssertionError ----------------------------------------------------------------------
from nose.tools import assert_true def test_equality(): assert_true(False)
from nose.tools import assert_true
from unittest import TestCase
class ExampleTest(TestCase):
def setUp(self): # setUp & tearDown are both available
self.blah = False
def test_blah(self):
self.assertTrue(self.blah)
(test)jhaddad@jons-mac-pro ~VIRTUAL_ENV/src$ nosetests F ====================================================================== FAIL: test_blah (test_nose_example.ExampleTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/jhaddad/.virtualenvs/test/src/test_nose_example.py", line 11, in test_blah self.assertTrue(self.blah) AssertionError: False is not true ---------------------------------------------------------------------- Ran 1 test in 0.003s FAILED (failures=1)
import mock
from mock import patch
from time import sleep
class Sweetness(object):
def slow_remote_call(self):
sleep(10)
return "some_data" # lets pretend we get this back from our remote api call
def test_long_call():
s = Sweetness()
result = s.slow_remote_call()
assert result == "some_data"
(test)jhaddad@jons-mac-pro ~VIRTUAL_ENV/src$ nosetests test_mock.py Ran 1 test in 10.001s OK
import mock
from mock import patch
from time import sleep
class Sweetness(object):
def slow_remote_call(self):
sleep(10)
return "some_data" # lets pretend we get this back from our remote api call
def test_long_call():
s = Sweetness()
with patch.object(s, "slow_remote_call", return_value="some_data"):
result = s.slow_remote_call()
assert result == "some_data"
(test)jhaddad@jons-mac-pro ~VIRTUAL_ENV/src$ nosetests test_mock.py . ---------------------------------------------------------------------- Ran 1 test in 0.001s OK
a = 1 b = 2 a = b
(test)jhaddad@jons-mac-pro ~VIRTUAL_ENV/src$ python -m trace --trace tracing.py 1 ? --- modulename: tracing, funcname: <module> tracing.py(1): a = 1 tracing.py(2): b = 2 tracing.py(3): a = b --- modulename: trace, funcname: _unsettrace trace.py(80): sys.settrace(None)
from gevent import monkey monkey.patch_all() from time import sleep, time def fetch_url(url): print "Fetching %s" % url sleep(10) print "Done fetching %s" % url from gevent.pool import Pool urls = ["http://test.com", "http://bacon.com", "http://eggs.com"] p = Pool(10) start = time() p.map(fetch_url, urls) print time() - start
(test)jhaddad@jons-mac-pro ~VIRTUAL_ENV/src$ python g.py Fetching http://test.com Fetching http://bacon.com Fetching http://eggs.com Done fetching http://test.com Done fetching http://bacon.com Done fetching http://eggs.com 10.001791954
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有