Brianna Laugher pfctdayelise

View issue4806.py
1 2 3 4 5 6 7 8 9
# written in python2.7
 
 
def bad(n):
if n == 1:
raise ValueError('n is 1!')
if n == 2:
raise TypeError('n is 2!')
return n, 2*n
View memes.pl
1 2 3 4 5 6 7 8 9
% Generate/verify memes in Prolog.
 
 
noun(apple).
noun(banana).
noun(orange).
noun(kiwifruit).
 
irregular_noun(kiwifruit, kiwifruit).
View 2.3.5_before.py
1 2 3 4 5 6 7 8
import pytest
 
@pytest.mark.parametrize("input", "expected", [
("3+5", 8),
("2+4", 6),
])
def test_evalPassing(input, expected):
assert eval(input) == expected
View trickysorting.ipynb
1 2 3 4 5 6 7 8 9 10
{
"metadata": {
"name": "Tricky sorting"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
View embeddinghtml.ipynb
1 2 3 4 5 6 7 8 9 10
{
"metadata": {
"name": "testing iframes"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
View conftest.py
1 2 3 4 5 6 7 8 9 10
def pytest_generate_tests(metafunc):
"""
If the test_ fn has a idparametrize mark, use it to create parametrized
tests with ids. Instead of giving a list of argvals (test values), it
should be a dict of test id strings -> tuple of test values
e.g.
@py.test.mark.idparametrize(('a', 'b'), {
'foo': (1, 2),
'bar': (3, 4),
})
View progressive.py
1 2 3 4 5 6 7 8 9 10
"""Public domain, yo.
See http://brianna.laugher.id.au/blog/79/the-progressive-speaking-stack-in-python for background.
"""
 
class Speaker:
def __init__(self, name):
self.name = name
self._hasSpoken = False
 
def __eq__(self, other):
View adb logcat output
1 2 3 4 5 6 7 8 9
 
I/dalvikvm( 1836): Failed resolving Lorg/thoughtcrime/securesms/ConversationListFragment$1; interface 573 'Landroid/widget/SearchView$OnQueryTextListener;'
W/dalvikvm( 1836): Link of class 'Lorg/thoughtcrime/securesms/ConversationListFragment$1;' failed
E/dalvikvm( 1836): Could not find class 'org.thoughtcrime.securesms.ConversationListFragment$1', referenced from method org.thoughtcrime.securesms.ConversationListFragment.initializeSearch
W/dalvikvm( 1836): VFY: unable to resolve new-instance 1205 (Lorg/thoughtcrime/securesms/ConversationListFragment$1;) in Lorg/thoughtcrime/securesms/ConversationListFragment;
D/dalvikvm( 1836): VFY: replacing opcode 0x22 at 0x0000
D/dalvikvm( 1836): VFY: dead code 0x0002-0008 in Lorg/thoughtcrime/securesms/ConversationListFragment;.initializeSearch (Landroid/widget/SearchView;)V
E/dalvikvm( 1836): Could not find class 'android.widget.SearchView', referenced from method org.thoughtcrime.securesms.ConversationListFragment.onPrepareOptionsMenu
W/dalvikvm( 1836): VFY: unable to
View 00-intro_errorreporting.txt
1 2 3 4 5 6 7 8 9
These are snippets of py.test in action, used in a talk given at
PyCon AU 2012 in Hobart, Tasmania. They are all relevant for
py.test 2.2 except where specified. Where taken from open source
projects I have listed a URL, some examples are from the py.test
documentation, some are from my workplace.
 
Apart from things called test_*, these functions should probably
be in your conftest.py, although they can generally start life in
your test files.
View mockingwithdecorators.py
1 2 3 4 5 6 7 8 9
 
class Foo(object):
def __init__(self, a, b):
self._a = a
self._b = b
 
@property
def a(self):
return self._a
Something went wrong with that request. Please try again.