test module for the custom examples custom 1 import custom c1 custom custom c2 custom custom del c1 del c2 custom 2 import custom2 c1 custom2 custom jim fulton 42 c1 first jim c1 last fulton c1 number 42 c1 name jim fulton c1 first will c1 name will fulton c1 last tell c1 name will tell del c1 first c1 name traceback most recent call last attributeerror first c1 first traceback most recent call last attributeerror first c1 first drew c1 first drew del c1 number traceback most recent call last typeerror can t delete numericchar attribute c1 number2 c1 number 2 c1 first 42 c1 name 42 tell c2 custom2 custom c2 name c2 first c2 last del c2 first c2 first traceback most recent call last attributeerror first c2 first traceback most recent call last attributeerror first c2 name traceback most recent call last file stdin line 1 in attributeerror first c2 number 0 n3 custom2 custom jim fulton waaa traceback most recent call last file stdin line 1 in typeerror an integer is required got type str del c1 del c2 custom 3 import custom3 c1 custom3 custom jim fulton 42 c1 custom3 custom jim fulton 42 c1 name jim fulton del c1 first traceback most recent call last file stdin line 1 in typeerror cannot delete the first attribute c1 first 42 traceback most recent call last file stdin line 1 in typeerror the first attribute value must be a string c1 first will c1 name will fulton c2 custom3 custom c2 custom3 custom c2 custom3 custom n3 custom3 custom jim fulton waaa traceback most recent call last file stdin line 1 in typeerror an integer is required got type str del c1 del c2 custom 4 import custom4 c1 custom4 custom jim fulton 42 c1 first jim c1 last fulton c1 number 42 c1 name jim fulton c1 first will c1 name will fulton c1 last tell c1 name will tell del c1 first traceback most recent call last typeerror cannot delete the first attribute c1 name will tell c1 first drew c1 first drew del c1 number traceback most recent call last typeerror can t delete numericchar attribute c1 number2 c1 number 2 c1 first 42 traceback most recent call last typeerror the first attribute value must be a string c1 name drew tell c2 custom4 custom c2 custom4 custom c2 custom4 custom c2 custom4 custom c2 name c2 first c2 last c2 number 0 n3 custom4 custom jim fulton waaa traceback most recent call last typeerror an integer is required got type str test cyclic gc import gc gc disable class subclasscustom4 custom pass s subclass s cycle s s cycle appends cycle x object s x x del s sys getrefcountx 3 ignore gc collect sys getrefcountx 2 gc enable
if __name__ == "__main__":
    import doctest, __main__
    doctest.testmod(__main__)