SlideShare a Scribd company logo
Unit testing

 For those seeking instant
       gratification
Maciej Bliziński <blizinski@google.com>
       Python Ireland 2010-11-10
Helps the design
Provides live documentation
Helps refactoring
But I'm hungry right now!
I love to see my code run
Python Ireland Nov 2010 Talk: Unit Testing
task: Index a list of dictionaries by one of the fields

def IndexBy(d_list, field_name):
 result = {}
 for d in d_list:
  result[d[field_name]] = d
 return result
def MakePackageNameBySoname(soname):                                          (continued...)
 """Find the package name based on the soname.
                                                                               for key in parsed:
 Returns a pair of pkgname, catalogname.                                         if parsed[key]:
 """                                                                               keywords_pkgname[key] = SonameToStringWithChar(parsed[key], "-")
 def AddSeparator(d, sep):                                                         keywords_catalogname[key] = SonameToStringWithChar(parsed[key], "_")
   """Adds a separator based on the neighboring                                  else:
   of two digits."""                                                               keywords_pkgname[key] = ""
   dc = copy.copy(d)                                                               keywords_catalogname[key] = ""
   if dc["version"]:                                                           pkgname_list = []
     if (dc["basename"][-1].isdigit()                                          keywords_pkgname = AddSeparator(keywords_pkgname, "-")
        and                                                                    pkgname_list.append(
        dc["version"][0].isdigit()):                                               "CSW%(basename)s%(sep)s%(version)s" % keywords_pkgname)
       dc["sep"] = sep                                                         keywords_catalogname = AddSeparator(keywords_catalogname, "_")
     else:                                                                     catalogname_list = [
       dc["sep"] = ""                                                              "%(basename)s%(sep)s%(version)s" % keywords_catalogname,
   else:                                                                       ]
     dc["sep"] = ""                                                            return pkgname_list, catalogname_list
   return dc
 soname_re = re.compile(r"(?P<basename>[w+]+([.-]+[w+]+)*)"
                  r".so"
                  r"(.(?P<version>[d.]+))?"
                  r"$")
 m = soname_re.match(soname)
 if not m:
   # There was no ".so" component, so it's hardo to figure out which one is
   # the name, but we'll try to figure out the numeric part of the soname.
   digits = "".join(re.findall(r"[0-9]+", soname))
   alnum = "".join(re.findall(r"[a-zA-Z]+", soname))
   parsed = {
       "basename": alnum,
       "version": digits,
   }
 else:
   parsed = m.groupdict()
 keywords_pkgname = {}
 keywords_catalogname = {}




                                                                                                           Real life example
task: Index a list of dictionaries by one of the fields

def IndexBy(d_list, field_name):
 result = {}
 for d in d_list:
  result[d[field_name]] = d
 return result
import example_1

def main():
 d = [{"foo": "a", "bar": "b"},
    {"foo": "c", "bar": "d"}]
 print example_1.IndexBy(d, "foo")

if __name__ == '__main__':
  main()
import unittest
import example_1
import pprint

class IndexByUnitTest(unittest.TestCase):

 def testTwoElements(self):
  d = [{"foo": "a", "bar": "b"},
      {"foo": "c", "bar": "d"}]
  pprint.pprint(example_1.IndexBy(d, "foo"))

if __name__ == '__main__':
  unittest.main()
import unittest
import example_1


class IndexByUnitTest(unittest.TestCase):

 def testTwoElements(self):
  d = [{"foo": "a", "bar": "b"},
      {"foo": "c", "bar": "d"}]
  expected = {
     'a': {'foo': 'a', 'bar': 'b'},
     'c': {'foo': 'c', 'bar': 'd'},
  }
  self.assertEquals(expected, example_1.IndexBy(d, "foo"))

if __name__ == '__main__':
  unittest.main()
blizinski@workstation ~/unit-test-talk $ python2.6 example_1_test.py
.
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK
Cultured way of playing with code
Changing your code
import unittest
import example_1


class IndexByUnitTest(unittest.TestCase):

 def testTwoElements(self):
  d = [{"foo": "a", "bar": "b"},
      {"foo": "c", "bar": "d"},
      {"foo": "c", "bar": "e"}]
  expected = {
     'a': {'foo': 'a', 'bar': 'b'},
     'c': {'foo': 'c', 'bar': 'd'},
  }
  self.assertEquals(expected, example_1.IndexBy(d, "foo"))

if __name__ == '__main__':
  unittest.main()
Python Ireland Nov 2010 Talk: Unit Testing
task: Index a list of dictionaries by one of the fields

def IndexBy(d_list, field_name):
 result = {}
 for d in d_list:
  result.setdefault(d[field_name], [])
  result[d[field_name]].append(d)
 return result
Keeping a track record
def testMakePackageNameDashesNoDashes(self):
 soname = "libpyglib-2.0-python.so.0"
 expected = (
   ['CSWlibpyglib2-0python0'],
   ['libpyglib2_0python0'],
 )
 self.assertEqual(expected,
            su.MakePackageNameBySoname(soname))

def testMakePackageNameDashesNoDashesPython(self):
 soname = "libpython3.1.so.1.0"
 expected = (
   ['CSWlibpython3-1-1-0'],
   ['libpython3_1_1_0'],
 )
 self.assertEqual(expected,
            su.MakePackageNameBySoname(soname))
The trust issue

Your first steps in unit testing
Hug me, I only look alien!
    (never mind my boxing gloves)
Python Ireland Nov 2010 Talk: Unit Testing
It's about the way
  pieces of code
    fit together
Your trust will gradually shift
Part of the development process
It's a tool which helps with
some of the everyday tasks.
Further reading

  http://en.wikipedia.org/wiki/Unit_testing
  http://diveintopython.org/unit_testing/index.html
  Mock objects, stubs and fakes


Contact
         Maciej Bliziński <blizinski@google.com>
References

Images:

      http://commons.wikimedia.org/wiki/File:Pantheon_rome_inside_1-muniu.jpg by Muniu
      http://commons.wikimedia.org/wiki/File:Instant_miso_soup.jpg by Gleam
      http://www.flickr.com/photos/f-oxymoron/4203860207/sizes/l/in/photostream/ by f-oxymoron
      http://www.flickr.com/photos/jurvetson/1381322008/sizes/l/in/photostream/ by jurvetson
      http://www.flickr.com/photos/7332902@N05/3221210836/ by David O'Driscoll
      http://www.flickr.com/photos/edsweeney/4212380812/sizes/o/in/photostream/ by Ed Sweeney
http://www.flickr.com/photos/jenny-pics/3230153121/sizes/l/in/photostream/ by jenny downing
      http://www.flickr.com/photos/oskay/265899766/ by Windell Oskay
      http://www.flickr.com/photos/alismith44/357361903/ by Ali West
      http://www.flickr.com/photos/cezaryborysiuk/3947857278/ by Cezary Borysiuk
      http://www.flickr.com/photos/wilhei/109403331/ by wilhei55
      http://www.flickr.com/photos/antonymayfield/3221876089/ by antony_mayfield
      http://www.flickr.com/photos/ralphandjenny/4999895776/ by Ralph Daily

More Related Content

What's hot (20)

PDF
はじめてのGroovy
Tsuyoshi Yamamoto
 
TXT
Gta v savegame
hozayfa999
 
PDF
Agile database access with CakePHP 3
José Lorenzo Rodríguez Urdaneta
 
PDF
Perforce Object and Record Model
Perforce
 
PDF
PHP 7 – What changed internally? (Forum PHP 2015)
Nikita Popov
 
PDF
Everything About PowerShell
Gaetano Causio
 
KEY
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Masahiro Nagano
 
PDF
Internationalizing CakePHP Applications
Pierre MARTIN
 
PDF
PHP 7 – What changed internally?
Nikita Popov
 
KEY
Jython: Python para la plataforma Java (EL2009)
Leonardo Soto
 
KEY
Jython: Python para la plataforma Java (JRSL 09)
Leonardo Soto
 
KEY
Php 101: PDO
Jeremy Kendall
 
PDF
Future of HTTP in CakePHP
markstory
 
PPTX
Presentation1
Rahadyan Gusti
 
PPTX
PHP performance 101: so you need to use a database
Leon Fayer
 
PDF
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
Suyeol Jeon
 
PPTX
Database performance 101
Leon Fayer
 
PDF
Perl Bag of Tricks - Baltimore Perl mongers
brian d foy
 
PDF
Teaching Your Machine To Find Fraudsters
Ian Barber
 
はじめてのGroovy
Tsuyoshi Yamamoto
 
Gta v savegame
hozayfa999
 
Agile database access with CakePHP 3
José Lorenzo Rodríguez Urdaneta
 
Perforce Object and Record Model
Perforce
 
PHP 7 – What changed internally? (Forum PHP 2015)
Nikita Popov
 
Everything About PowerShell
Gaetano Causio
 
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Masahiro Nagano
 
Internationalizing CakePHP Applications
Pierre MARTIN
 
PHP 7 – What changed internally?
Nikita Popov
 
Jython: Python para la plataforma Java (EL2009)
Leonardo Soto
 
Jython: Python para la plataforma Java (JRSL 09)
Leonardo Soto
 
Php 101: PDO
Jeremy Kendall
 
Future of HTTP in CakePHP
markstory
 
Presentation1
Rahadyan Gusti
 
PHP performance 101: so you need to use a database
Leon Fayer
 
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
Suyeol Jeon
 
Database performance 101
Leon Fayer
 
Perl Bag of Tricks - Baltimore Perl mongers
brian d foy
 
Teaching Your Machine To Find Fraudsters
Ian Barber
 

Viewers also liked (14)

PDF
Softwarequalitätssicherung mit Continuous Integration Tools
GFU Cyrus AG
 
PPTX
Unit Testing with Python
MicroPyramid .
 
PDF
Mock testing mit Python
Timo Stollenwerk
 
PDF
Python testing using mock and pytest
Suraj Deshmukh
 
PDF
TDD in Python With Pytest
Eddy Reyes
 
PDF
Python-nose: A unittest-based testing framework for Python that makes writing...
Timo Stollenwerk
 
PDF
Python Unit Test
David Xie
 
PPTX
Python in Test automation
Krishnana Sreeraman
 
PDF
Py.test
soasme
 
PDF
Test Driven Development With Python
Siddhi
 
PPTX
Automated Python Test Frameworks for Hardware Verification and Validation
Barbara Jones
 
PPT
Automated hardware testing using python
Yuvaraja Ravi
 
PDF
Effective python
Abhijeet Kasurde
 
PPTX
unittest in 5 minutes
Ray Toal
 
Softwarequalitätssicherung mit Continuous Integration Tools
GFU Cyrus AG
 
Unit Testing with Python
MicroPyramid .
 
Mock testing mit Python
Timo Stollenwerk
 
Python testing using mock and pytest
Suraj Deshmukh
 
TDD in Python With Pytest
Eddy Reyes
 
Python-nose: A unittest-based testing framework for Python that makes writing...
Timo Stollenwerk
 
Python Unit Test
David Xie
 
Python in Test automation
Krishnana Sreeraman
 
Py.test
soasme
 
Test Driven Development With Python
Siddhi
 
Automated Python Test Frameworks for Hardware Verification and Validation
Barbara Jones
 
Automated hardware testing using python
Yuvaraja Ravi
 
Effective python
Abhijeet Kasurde
 
unittest in 5 minutes
Ray Toal
 
Ad

Similar to Python Ireland Nov 2010 Talk: Unit Testing (7)

PPTX
Five
Łukasz Langa
 
PDF
Python 2.5 reference card (2009)
gekiaruj
 
PPTX
Clonewise - Automatically Detecting Package Clones and Inferring Security Vu...
Silvio Cesare
 
ODP
(1) c sharp introduction_basics_dot_net
Nico Ludwig
 
ODP
(2) c sharp introduction_basics_part_i
Nico Ludwig
 
PDF
IT Data Visualization - Sumit 2008
Raffael Marty
 
PPTX
Ropython-windbg-python-extensions
Alin Gabriel Serdean
 
Python 2.5 reference card (2009)
gekiaruj
 
Clonewise - Automatically Detecting Package Clones and Inferring Security Vu...
Silvio Cesare
 
(1) c sharp introduction_basics_dot_net
Nico Ludwig
 
(2) c sharp introduction_basics_part_i
Nico Ludwig
 
IT Data Visualization - Sumit 2008
Raffael Marty
 
Ropython-windbg-python-extensions
Alin Gabriel Serdean
 
Ad

More from Python Ireland (20)

PDF
Async I/O in Python
Python Ireland
 
PDF
Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati
Python Ireland
 
PDF
Python Ireland - Who, how, what
Python Ireland
 
PPT
Object Orientation vs. Functional Programming in Python
Python Ireland
 
PDF
What's the Scoop with Python 3?
Python Ireland
 
PDF
Google App Engine in 40 minutes (the absolute essentials)
Python Ireland
 
PDF
Introduction to Erlang for Python Programmers
Python Ireland
 
PPT
Web-service based Mobile Geospatial Application Development using Python
Python Ireland
 
PDF
Utopia Kingdoms scaling case. From 4 users to 50.000+
Python Ireland
 
PPT
The Larch - a visual interactive programming environment
Python Ireland
 
PDF
Python vs JLizard.... a python logging experience
Python Ireland
 
PDF
Vim and Python
Python Ireland
 
PDF
Python Ireland Nov 2009 Talk - Appengine
Python Ireland
 
ODP
Python Ireland May 2011 - What is Pyramid and where is it with respect to Dja...
Python Ireland
 
PDF
Python Ireland Nov 2010 - RESTing with Django
Python Ireland
 
ODP
Python Ireland Feb '11 Talks: Introduction to Python
Python Ireland
 
PPTX
Python Ireland Dec Talks - Windows Azure -- The Nuts and Bolts
Python Ireland
 
PDF
Lambada
Python Ireland
 
KEY
Python for cloud computing
Python Ireland
 
ODP
IPython: The awesome python shell
Python Ireland
 
Async I/O in Python
Python Ireland
 
Python Ireland 2012 - Message brokers and Python by Fernando Ciciliati
Python Ireland
 
Python Ireland - Who, how, what
Python Ireland
 
Object Orientation vs. Functional Programming in Python
Python Ireland
 
What's the Scoop with Python 3?
Python Ireland
 
Google App Engine in 40 minutes (the absolute essentials)
Python Ireland
 
Introduction to Erlang for Python Programmers
Python Ireland
 
Web-service based Mobile Geospatial Application Development using Python
Python Ireland
 
Utopia Kingdoms scaling case. From 4 users to 50.000+
Python Ireland
 
The Larch - a visual interactive programming environment
Python Ireland
 
Python vs JLizard.... a python logging experience
Python Ireland
 
Vim and Python
Python Ireland
 
Python Ireland Nov 2009 Talk - Appengine
Python Ireland
 
Python Ireland May 2011 - What is Pyramid and where is it with respect to Dja...
Python Ireland
 
Python Ireland Nov 2010 - RESTing with Django
Python Ireland
 
Python Ireland Feb '11 Talks: Introduction to Python
Python Ireland
 
Python Ireland Dec Talks - Windows Azure -- The Nuts and Bolts
Python Ireland
 
Python for cloud computing
Python Ireland
 
IPython: The awesome python shell
Python Ireland
 

Recently uploaded (20)

PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PPTX
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
UiPath Academic Alliance Educator Panels: Session 2 - Business Analyst Content
DianaGray10
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 

Python Ireland Nov 2010 Talk: Unit Testing

  • 1. Unit testing For those seeking instant gratification Maciej Bliziński <[email protected]> Python Ireland 2010-11-10
  • 2. Helps the design Provides live documentation Helps refactoring
  • 3. But I'm hungry right now!
  • 4. I love to see my code run
  • 6. task: Index a list of dictionaries by one of the fields def IndexBy(d_list, field_name): result = {} for d in d_list: result[d[field_name]] = d return result
  • 7. def MakePackageNameBySoname(soname): (continued...) """Find the package name based on the soname. for key in parsed: Returns a pair of pkgname, catalogname. if parsed[key]: """ keywords_pkgname[key] = SonameToStringWithChar(parsed[key], "-") def AddSeparator(d, sep): keywords_catalogname[key] = SonameToStringWithChar(parsed[key], "_") """Adds a separator based on the neighboring else: of two digits.""" keywords_pkgname[key] = "" dc = copy.copy(d) keywords_catalogname[key] = "" if dc["version"]: pkgname_list = [] if (dc["basename"][-1].isdigit() keywords_pkgname = AddSeparator(keywords_pkgname, "-") and pkgname_list.append( dc["version"][0].isdigit()): "CSW%(basename)s%(sep)s%(version)s" % keywords_pkgname) dc["sep"] = sep keywords_catalogname = AddSeparator(keywords_catalogname, "_") else: catalogname_list = [ dc["sep"] = "" "%(basename)s%(sep)s%(version)s" % keywords_catalogname, else: ] dc["sep"] = "" return pkgname_list, catalogname_list return dc soname_re = re.compile(r"(?P<basename>[w+]+([.-]+[w+]+)*)" r".so" r"(.(?P<version>[d.]+))?" r"$") m = soname_re.match(soname) if not m: # There was no ".so" component, so it's hardo to figure out which one is # the name, but we'll try to figure out the numeric part of the soname. digits = "".join(re.findall(r"[0-9]+", soname)) alnum = "".join(re.findall(r"[a-zA-Z]+", soname)) parsed = { "basename": alnum, "version": digits, } else: parsed = m.groupdict() keywords_pkgname = {} keywords_catalogname = {} Real life example
  • 8. task: Index a list of dictionaries by one of the fields def IndexBy(d_list, field_name): result = {} for d in d_list: result[d[field_name]] = d return result
  • 9. import example_1 def main(): d = [{"foo": "a", "bar": "b"}, {"foo": "c", "bar": "d"}] print example_1.IndexBy(d, "foo") if __name__ == '__main__': main()
  • 10. import unittest import example_1 import pprint class IndexByUnitTest(unittest.TestCase): def testTwoElements(self): d = [{"foo": "a", "bar": "b"}, {"foo": "c", "bar": "d"}] pprint.pprint(example_1.IndexBy(d, "foo")) if __name__ == '__main__': unittest.main()
  • 11. import unittest import example_1 class IndexByUnitTest(unittest.TestCase): def testTwoElements(self): d = [{"foo": "a", "bar": "b"}, {"foo": "c", "bar": "d"}] expected = { 'a': {'foo': 'a', 'bar': 'b'}, 'c': {'foo': 'c', 'bar': 'd'}, } self.assertEquals(expected, example_1.IndexBy(d, "foo")) if __name__ == '__main__': unittest.main()
  • 12. blizinski@workstation ~/unit-test-talk $ python2.6 example_1_test.py . ---------------------------------------------------------------------- Ran 1 test in 0.000s OK
  • 13. Cultured way of playing with code
  • 15. import unittest import example_1 class IndexByUnitTest(unittest.TestCase): def testTwoElements(self): d = [{"foo": "a", "bar": "b"}, {"foo": "c", "bar": "d"}, {"foo": "c", "bar": "e"}] expected = { 'a': {'foo': 'a', 'bar': 'b'}, 'c': {'foo': 'c', 'bar': 'd'}, } self.assertEquals(expected, example_1.IndexBy(d, "foo")) if __name__ == '__main__': unittest.main()
  • 17. task: Index a list of dictionaries by one of the fields def IndexBy(d_list, field_name): result = {} for d in d_list: result.setdefault(d[field_name], []) result[d[field_name]].append(d) return result
  • 18. Keeping a track record
  • 19. def testMakePackageNameDashesNoDashes(self): soname = "libpyglib-2.0-python.so.0" expected = ( ['CSWlibpyglib2-0python0'], ['libpyglib2_0python0'], ) self.assertEqual(expected, su.MakePackageNameBySoname(soname)) def testMakePackageNameDashesNoDashesPython(self): soname = "libpython3.1.so.1.0" expected = ( ['CSWlibpython3-1-1-0'], ['libpython3_1_1_0'], ) self.assertEqual(expected, su.MakePackageNameBySoname(soname))
  • 20. The trust issue Your first steps in unit testing
  • 21. Hug me, I only look alien! (never mind my boxing gloves)
  • 23. It's about the way pieces of code fit together
  • 24. Your trust will gradually shift
  • 25. Part of the development process
  • 26. It's a tool which helps with some of the everyday tasks.
  • 27. Further reading http://en.wikipedia.org/wiki/Unit_testing http://diveintopython.org/unit_testing/index.html Mock objects, stubs and fakes Contact Maciej Bliziński <[email protected]>
  • 28. References Images: http://commons.wikimedia.org/wiki/File:Pantheon_rome_inside_1-muniu.jpg by Muniu http://commons.wikimedia.org/wiki/File:Instant_miso_soup.jpg by Gleam http://www.flickr.com/photos/f-oxymoron/4203860207/sizes/l/in/photostream/ by f-oxymoron http://www.flickr.com/photos/jurvetson/1381322008/sizes/l/in/photostream/ by jurvetson http://www.flickr.com/photos/7332902@N05/3221210836/ by David O'Driscoll http://www.flickr.com/photos/edsweeney/4212380812/sizes/o/in/photostream/ by Ed Sweeney http://www.flickr.com/photos/jenny-pics/3230153121/sizes/l/in/photostream/ by jenny downing http://www.flickr.com/photos/oskay/265899766/ by Windell Oskay http://www.flickr.com/photos/alismith44/357361903/ by Ali West http://www.flickr.com/photos/cezaryborysiuk/3947857278/ by Cezary Borysiuk http://www.flickr.com/photos/wilhei/109403331/ by wilhei55 http://www.flickr.com/photos/antonymayfield/3221876089/ by antony_mayfield http://www.flickr.com/photos/ralphandjenny/4999895776/ by Ralph Daily