| LEFT | RIGHT |
| 1 # Sample script for use by test_dtrace.py | 1 # Sample script for use by test_dtrace.py |
| 2 # DO NOT MODIFY THIS FILE IN ANY WAY WITHOUT UPDATING test_dtrace.py!!!!! | 2 # DO NOT MODIFY THIS FILE IN ANY WAY WITHOUT UPDATING test_dtrace.py!!!!! |
| 3 | 3 |
| 4 import gc | 4 import gc |
| 5 | 5 |
| 6 def function_1() : | 6 def function_1() : |
| 7 pass | 7 pass |
| 8 | 8 |
| 9 # Check stacktrace | 9 # Check stacktrace |
| 10 def function_2() : | 10 def function_2() : |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 def test_entry_return_and_stack() : | 25 def test_entry_return_and_stack() : |
| 26 function_1() | 26 function_1() |
| 27 function_2() | 27 function_2() |
| 28 function_3(*(1,2)) | 28 function_3(*(1,2)) |
| 29 function_4(**{"test":42}) | 29 function_4(**{"test":42}) |
| 30 function_5(*(1,2), **{"test":42}) | 30 function_5(*(1,2), **{"test":42}) |
| 31 | 31 |
| 32 def test_line() : | 32 def test_line() : |
| 33 a = 1 # Preamble | 33 a = 1 # Preamble |
| 34 for i in xrange(2) : | 34 for i in range(2) : |
| 35 a = i | 35 a = i |
| 36 b = i+2 | 36 b = i+2 |
| 37 c = i+3 | 37 c = i+3 |
| 38 d = a + b +c | 38 d = a + b +c |
| 39 a = 1 # Epilogue | 39 a = 1 # Epilogue |
| 40 |
| 41 def test_unicode_entry_return_and_stack() : |
| 42 def únícódé() : |
| 43 pass |
| 44 únícódé() |
| 40 | 45 |
| 41 def test_instance_creation_destruction() : | 46 def test_instance_creation_destruction() : |
| 42 class old_style_class() : | 47 class old_style_class() : |
| 43 pass | 48 pass |
| 44 class new_style_class(object) : | 49 class new_style_class(object) : |
| 45 pass | 50 pass |
| 46 | 51 |
| 47 a = old_style_class() | 52 a = old_style_class() |
| 48 del a | 53 del a |
| 49 gc.collect() | 54 gc.collect() |
| 50 b = new_style_class() | 55 b = new_style_class() |
| 51 del b | 56 del b |
| 52 gc.collect() | 57 gc.collect() |
| 53 | 58 |
| 54 a = old_style_class() | 59 a = old_style_class() |
| 55 del old_style_class | 60 del old_style_class |
| 56 gc.collect() | 61 gc.collect() |
| 57 b = new_style_class() | 62 b = new_style_class() |
| 58 del new_style_class | 63 del new_style_class |
| 59 gc.collect() | 64 gc.collect() |
| 60 del a | 65 del a |
| 61 gc.collect() | 66 gc.collect() |
| 62 del b | 67 del b |
| 63 gc.collect() | 68 gc.collect() |
| 64 | 69 |
| 65 def test_garbage_collection() : | 70 def test_garbage_collection() : |
| 66 gc.collect() | 71 gc.collect() |
| 67 | 72 |
| 73 |
| 68 if __name__ == "__main__": | 74 if __name__ == "__main__": |
| 69 test_entry_return_and_stack() | 75 test_entry_return_and_stack() |
| 70 test_line() | 76 test_line() |
| 77 test_unicode_entry_return_and_stack() |
| 71 test_instance_creation_destruction() | 78 test_instance_creation_destruction() |
| 72 test_garbage_collection() | 79 test_garbage_collection() |
| 73 | 80 |
| LEFT | RIGHT |