Search

16 July, 2018

Generator functions. Why and when should we use them.

You probably have heard of them. But as a beginner python programmer, we tend to ignore it's values because we fail to find uses of it. When we have loops and itertools and other fancy toys offered, why should we bother to understand them. If you want to take your programming  or understanding of Python to the next level, you must understand and use generators more and more.

25 June, 2018

How to test POST call using Python?


I got into a situation recently where I needed to test if my POST function was indeed working. 
    Its easy to test GET method . You just visit the URL and that's it . But for POST, you an use Plugins. But unfortunately I can't do that , because my browser (admin restrictions ) doesn't allow me to install plugins . Fortunately if you have Python , you can easily do that .


How to work on a Python Project when modules versions needed are different? Use virtualenv



Gone are the days when you need to create a VM for working on a different set of tools.  People work on different projects which might need a special version of a module. (Or python itself) . The problem aggravates when  multiple users work on a single shared machine (Test environments or Build machines ) .Virtual Environments help solve problem . And its easy to use and share among fellow teammates.

12 June, 2018

Exploring Numpy

What can we really do with Numpy? Why should we use it at all ?

Start with : import numpy

1. We can create arrays .


method: numpy.array(object, dtype=None, copy=True, order='K', subok=False, ndmin=0)


>>> a = numpy.array(range(10))
>>> a
array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>> a.dtype
dtype('int32')

In the above array, there are 10 columns and 1 row.

Note : The concept of rows and columns applies when you have a 2D array. However, the array numpy.array([1,2,3,4]) is a 1D array and so has only one dimension, therefore shape rightly returns a single valued iterable.

Refer this link


01 June, 2018

Python List sorting with key argument explored




Everybody uses lists as an array to store values. List provide a lot of in-build features.

  • Sorting
  • Membership
  • Indexing
  • Iteration
  • reversing
  • Adding/Removing
  • Popping
  • Count

Lots of reasons to use lists. I think, one of the most used features is sorting. Internally , python uses Merge sort technique to sort the array items. But the sort method can be used in many other ways to have more control.


29 May, 2018

SVN commands you must know as an Test Automation Engineer


In the course of automation and continuous integration , you will someday come across a stage where you have to perform svn operations . And obviously, using command line (forget fancy UIs to do your business) using command line. And then you will have to start digging in,  which will take a substantial amount time ...believe me.

25 May, 2018

How to use argparse module to create command line tools with Python?



Its been decades I have been using sys.argv for simple tasks related to argument parsing. But the thing is, sometimes we don't realize how good something is unless we use it . Like the argparse module.

The official document got me totally confused. So I wrote my own tutorial. Let's get started.