Profile cover photo
Profile photo
The Digital Cat
66 followers -
Learning is understanding
Learning is understanding

66 followers
About
The Digital Cat's posts

Post has attachment
As already stressed in the two introductory posts on TDD (you can find them here) testing requires to write some code that uses the functions and objects you are going to develop. This means that you need to isolate a given (external) function that is part of your public API and demonstrate that it works with standard inputs and in edge cases.

For example, if you are going to develop an object that stores percentages (such as for example poll results), you should test the following conditions: the class can store a standard percentage such as 42%, the class shall give an error if you try to store a negative percentage, the class shall give an error if you store a percentage greater than 100%.

Tests shall be idempotent and isolated. Idempotent in mathematics and computer science identifies a process that can be run multiple times without changing the status of the system. Isolated means that a test shall not change its behaviour depending on previous executions of itself, nor depend on the previous execution (or missing execution) of other tests.

Such restrictions, which guarantee that your tests are not passing due to a temporary configuration of the system or the order in which they are run, can raise big issues when dealing with external libraries and systems, or with intrinsically mutable concepts such as time. In the testing discipline, such issues are mostly faced using mocks, that is objects that pretend to be other objects.

In this series of posts I am going to review the Python mock library and exemplify its use. I will not cover everything you may do with mock, obviously, but hopefully I'll give you the information you need to start using this powerful library.

#Python   #TDD  

Post has attachment

Post has attachment
The second part of the small series on Python OOP and TDD

#python #oop #tdd #TheDigitalCat  

Post has attachment
Using gitflow with GitHub: a simple procedure (and a working tool).

http://goo.gl/GAxbua

#TheDigitalCat #git #github #gitflow  
Photo

Post has attachment
A simple example of #Python #OOP development (with #TDD ) - Part 1

#TheDigitalCat

Post has attachment
Python decorators: metaprogramming with style

goo.gl/EiWWRt

#Python #TheDigitalCat

Thanks +Bruce Eckel  for your original posts
Photo

Post has attachment
19 Apr 2015 - 9AM - Florence
goo.gl/HdlDZQ

+PyCon Italia #TheDigitalCat
Photo

Post has attachment
19 Apr 2015 - 9AM - Florence
goo.gl/HdlDZQ

+PyCon Italia #TheDigitalCat
Photo

Post has attachment
Photo

Post has shared content
Wait while more posts are being loaded