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
# Salvar arvore html da página de vídeos pythonbrasil no arquivo /tmp/dom.html | |
# http://www.youtube.com/user/pythonbrazil/videos?view=0&sort=dd&live_view=500&flow=list | |
# BeautifulSoup versão 3.2.1, o método para buscar a classe mudou na versão 4. | |
s = file('/tmp/dom.html').read() | |
from BeautifulSoup import BeautifulSoup as BS | |
soup = BS(s) | |
soup.findAll('li', { "class" : "yt-lockup clearfix channels-browse-content-list-item yt-lockup-video yt-lockup-tile vve-check context-data-item" }) | |
items = soup.findAll('li', { "class" : "yt-lockup clearfix channels-browse-content-list-item yt-lockup-video yt-lockup-tile vve-check context-data-item" }) | |
l = [x.attrMap['data-context-item-title'] for x in items] |
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 codeanalysis.cfg | |
[buildout] | |
extends = | |
buildout.cfg | |
auto-checkout = plone.recipe.codeanalysis | |
parts += code-analysis | |
[sources] | |
plone.recipe.codeanalysis = git https://github.com/plone/plone.recipe.codeanalysis.git |
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
# csslint incorrect.css correct.css | |
csslint: There are 2 problems in incorrect.css. | |
incorrect.css | |
1: error at line 2, col 1 | |
Unexpected token '{' at line 2, col 1. | |
{} |
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
Patching and mocking Plone unittests with using mock | |
---------------------------------------------------- | |
The python mock module was created by Michael Foord and it has been integrated in the unittest module since python version 3.3. It's license is BSD as it is possible to see in the official `homepage of the project`_. | |
.. _homepage of the project: http://www.voidspace.org.uk/python/mock/index.html | |
It allows you to replace parts of your system under test with mock objects and make assertions about how they have been used. | |
You can use it to replace methods or properties, as it will be shown in the following examples. |
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
Patching and mocking Plone unittests with using mock | |
---------------------------------------------------- | |
The python mock module was created by Michael Foord and it has been integrated in the unittest module since python version 3.3. It's license is BSD as it is possible to see in the official `homepage of the project`_. | |
.. _homepage of the project: http://www.voidspace.org.uk/python/mock/index.html | |
It allows you to replace parts of your system under test with mock objects and make assertions about how they have been used. | |
You can use it to replace methods or properties, as it will be shown in the following examples. |
NewerOlder