|
Revision 35, 1.1 kB
(checked in by arjanmol, 7 years ago)
|
Added new directory: tree
|
- Property svn:eol-style set to
native
- Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
import UML |
|---|
| 7 |
import diagram |
|---|
| 8 |
|
|---|
| 9 |
cnt=0 |
|---|
| 10 |
def print_hash(): |
|---|
| 11 |
global cnt |
|---|
| 12 |
UML.update_model() |
|---|
| 13 |
cnt = len(UML.Element._hash.keys()) |
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
print "Creating diagram:" |
|---|
| 19 |
dia = diagram.Diagram() |
|---|
| 20 |
print_hash() |
|---|
| 21 |
assert (cnt == 1) |
|---|
| 22 |
|
|---|
| 23 |
print "Creating item:" |
|---|
| 24 |
item = dia.create_item (diagram.Actor) |
|---|
| 25 |
print_hash() |
|---|
| 26 |
assert (cnt == 2) |
|---|
| 27 |
|
|---|
| 28 |
print "Deleting created items:" |
|---|
| 29 |
item.get_subject().unlink() |
|---|
| 30 |
del item |
|---|
| 31 |
dia.unlink () |
|---|
| 32 |
del dia |
|---|
| 33 |
print_hash() |
|---|
| 34 |
assert (cnt == 0) |
|---|
| 35 |
|
|---|
| 36 |
print "Creating diagram:" |
|---|
| 37 |
dia = diagram.Diagram() |
|---|
| 38 |
print_hash() |
|---|
| 39 |
assert (cnt == 1) |
|---|
| 40 |
|
|---|
| 41 |
print "Creating item:" |
|---|
| 42 |
item = dia.create_item (diagram.Actor) |
|---|
| 43 |
print_hash() |
|---|
| 44 |
assert (cnt == 2) |
|---|
| 45 |
|
|---|
| 46 |
print "Deleting created items:" |
|---|
| 47 |
dia.unlink() |
|---|
| 48 |
item.get_subject().unlink() |
|---|
| 49 |
del dia |
|---|
| 50 |
print 'Unref\'ing this one will cause a core dump' |
|---|
| 51 |
del item |
|---|
| 52 |
print 'Hmmm... That seems not to be the problem' |
|---|
| 53 |
print_hash() |
|---|
| 54 |
print 'And not the assertion...' |
|---|
| 55 |
assert (cnt == 0) |
|---|
| 56 |
print 'OK' |
|---|