code at the bottom of the file that contains the objects to be testedlike thisadd incremental self-test code class persondef __init__(selfnamejob=nonepay= )self name name self job job self pay pay bob person('bob smith'sue person('sue jones'job='dev'pay= print(bob namebob payprint(sue namesue paytest the class runs __init__ automatically fetch attached attributes sue' and bob' attrs differ notice here that the bob object accepts the defaults for job and paybut sue provides values explicitly also note how we use keyword arguments when making suewe could pass by position insteadbut the keywords may help remind us later what the data isand they allow us to pass the arguments in any left-to-right order we like againdespite its unusual name__init__ is normal functionsupporting everything you already know about functions--including both defaults and pass-by-name keyword arguments when this file runs as scriptthe test code at the bottom makes two instances of our class and prints two attributes of each (name and pay) :\codeperson py bob smith sue jones you can also type this file' test code at python' interactive prompt (assuming you import the person class there first)but coding canned tests inside the module file like this makes it much easier to rerun them in the future although this is fairly simple codeit' already demonstrating something important notice that bob' name is not sue'sand sue' pay is not bob' each is an independent record of information technicallybob and sue are both namespace objects--like all class instancesthey each have their own independent copy of the state information created by the class because each instance of class has its own set of self attributesclasses are natural for recording information for multiple objects this wayjust like built-in types such as lists and dictionariesclasses serve as sort of object factory other python program structuressuch as functions and moduleshave no such concept ' closure functions come close in terms of per-call statebut don' have the multiple methodsinheritanceand larger structure we get from classes using code two ways as isthe test code at the bottom of the file worksbut there' big catch--its top-level print statements run both when the file is run as script and when it is imported as more realistic example