def test_lumpy(self): lumpy = Lumpy.Lumpy() lumpy.restrict_class(Tests) lumpy.opaque_class(Tests) self.assertTrue(lumpy.is_opaque(Tests)) lumpy.transparent_class(Tests) self.assertFalse(lumpy.is_opaque(Tests)) lumpy.opaque_module(unittest) things_drawn = lumpy.object_diagram(loop=False) self.assertTrue(things_drawn > 200) things_drawn = lumpy.class_diagram(loop=False) self.assertTrue(things_drawn > 200)
from swampy.Lumpy import * import copy lumpy = Lumpy() lumpy.make_reference() class Card(object): """Represents a Poker Card. """ labels = ['straightflush', 'fourkind', 'fullhouse', 'flush', 'straight', 'threekind', 'twopair', 'pair', 'highcard'] def __init__(self, suit, rank): self.suit = suit self.rank = rank class Rectangle(object): """Represents a Rectangle. attribute: width, height, cornner of Point object """ class Point(object): """Represents a Point with 2-D space. attribute: x, y """
#!/usr/bin/python import swampy.Lumpy lumpy = Lumpy.Lumpy() # if you don't make a reference after instantiating # Lumpy, the local variable lumpy is visible. Even # so, the Lumpy class is opaque by default, so we # have to make it transparent. lumpy.transparent_class(Lumpy.Lumpy) lumpy.class_diagram()