vendredi 26 février 2021

how to write python testscript using classes and methods

I have python code which checks for request. If request = open, it should open the file else it should create new file. How to write testscript using classes and methods to check the operation. I have written testscript by importing the file1.py file.

`

from file1 import *

file2 = file1('', 'scm10.db', 'c')
print("srdid after creating file is", file2.srdid)
file2 = file1('', 'scm10.db', 'open')
print("after opening file srdid is", file2.srdid)

srdid is the dictionary element and is initially set to zero.

I want the above code to be written using classes and methods.

Aucun commentaire:

Enregistrer un commentaire