Python Unit Test Automation: Practical Techniques for Python Developers and Testers by Ashwin Pajankar

Python Unit Test Automation: Practical Techniques for Python Developers and Testers by Ashwin Pajankar

Author:Ashwin Pajankar [Ashwin Pajankar]
Language: eng
Format: epub, pdf
Publisher: Apress
Published: 2017-11-05T00:00:00+00:00


Placing the Development and Test Code in a Single Directory

Here, you will organize the dev and test code in a single directory. In the test directory, create a module called test_me.py and add the code in Listing 3-10 to it.

def add(x, y):

return(x + y)

def mul(x, y):

return(x * y)

def sub(x, y):

return(x - y)

def div(x, y):

return(x / y)

Listing 3-10.test_me.py

Now, since test_me. py is in the test directory, it can directly be imported into another module in the same directory using the import test_me statement. The test module in Listing 3-11 imports test_me.py to test its functionality.

import unittest

import test_me



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.