fgallina-python-el-expansions.feature (5499B)
1 @requires-e24-3 2 Feature: fgallinas python.el expansions 3 In order to quickly and precisely mark Python code blocks 4 As an Emacs user 5 I want to expand to them 6 7 Scenario: Baseline feature test. 8 Given I turn on python-mode 9 And there is no region selected 10 When I insert "run(23)" 11 And I place the cursor between "n" and "(" 12 And I press "C-@" 13 And I press "C-@" 14 Then the region should be "run(23)" 15 16 Scenario: Mark region inside a string. 17 Given I turn on python-mode 18 And there is no region selected 19 When I insert "'X-Men: Wolverine'" 20 And I place the cursor between "r" and "i" 21 And I press "C-@" 22 And I press "C-@" 23 Then the region should be "X-Men: Wolverine" 24 25 Scenario: Mark region inside a string with escape delimiter. 26 Given I turn on python-mode 27 And there is no region selected 28 When I insert "'pre' + 'X-Men: Wol\'verine' + 'post'" 29 And I place the cursor between "r" and "i" 30 And I press "C-@" 31 And I press "C-@" 32 Then the region should be "X-Men: Wol\'verine" 33 34 Scenario: Mark region outside a string. 35 Given I turn on python-mode 36 And there is no region selected 37 When I insert "run('X-Men: ' + 'Wolverine')" 38 And I place the cursor between "M" and "e" 39 And I press "C-@" 40 And I press "C-@" 41 And I press "C-@" 42 Then the region should be "'X-Men: '" 43 44 Scenario: Mark region inside a multi-line string. 45 Given I turn on python-mode 46 And there is no region selected 47 When I insert: 48 """ 49 print('lalelu') 50 51 '''This is a multi-line Python string 52 with lots of useless content. 53 ''' 54 55 print('lalelu') 56 """ 57 And I place the cursor between "-" and "l" 58 And I press "C-@" 59 And I press "C-@" 60 Then the region should be: 61 """ 62 This is a multi-line Python string 63 with lots of useless content. 64 65 """ 66 67 # Scenario: Mark region outside a multi-line string. 68 # Given I turn on python-mode 69 # And there is no region selected 70 # When I insert: 71 # """ 72 # '''This is a multi-line Python string 73 # with lots of useless content. 74 # ''' 75 # """ 76 # And I place the cursor between "-" and "l" 77 # And I press "C-@" 78 # And I press "C-@" 79 # And I press "C-@" 80 # Then the region should be: 81 # """ 82 # '''This is a multi-line Python string 83 # with lots of useless content. 84 # ''' 85 # """ 86 87 Scenario: Mark a basic Python block 88 Given I turn on python-mode 89 And there is no region selected 90 When I insert: 91 """ 92 if True: 93 print('To be, or not to be...') 94 else: 95 print('Booyah.') 96 """ 97 And I go to point "1" 98 And I press "C-@" 99 And I press "C-@" 100 And I press "C-@" 101 Then the region should be: 102 """ 103 if True: 104 print('To be, or not to be...') 105 """ 106 107 Scenario: Mark a Python block with a nested block 108 Given I turn on python-mode 109 And there is no region selected 110 When I insert: 111 """ 112 if True: 113 if True: 114 print(23) 115 print('To be, or not to be...') 116 else: 117 print('Booyah.') 118 """ 119 And I go to point "1" 120 And I press "C-@" 121 Then the region should be: 122 """ 123 if 124 """ 125 And I press "C-@" 126 Then the region should be: 127 """ 128 if True: 129 """ 130 And I press "C-@" 131 Then the region should be: 132 """ 133 if True: 134 if True: 135 print(23) 136 print('To be, or not to be...') 137 """ 138 139 Scenario: Mark another Python block with a nested block 140 Given I turn on python-mode 141 And there is no region selected 142 When I insert: 143 """ 144 def moo(data): 145 for foo in data.items(): 146 print(foo) 147 148 """ 149 And I go to point "1" 150 And I press "C-@" 151 And I press "C-@" 152 And I press "C-@" 153 Then the region should be: 154 """ 155 def moo(data): 156 for foo in data.items(): 157 print(foo) 158 """ 159 160 Scenario: Mark an outer Python block 161 Given I turn on python-mode 162 And there is no region selected 163 When I insert: 164 """ 165 print('More stuff') 166 167 def the_truth(): 168 if True: 169 print('To be, or not to be...') 170 else: 171 print('Booyah.') 172 173 print('Even more stuff.') 174 """ 175 And I go to the front of the word "if" 176 And I press "C-@" 177 Then the region should be: 178 """ 179 if 180 """ 181 And I press "C-@" 182 Then the region should be: 183 """ 184 if True: 185 """ 186 And I press "C-@" 187 Then the region should be: 188 """ 189 if True: 190 print('To be, or not to be...') 191 """ 192 And I press "C-@" 193 Then the region should be: 194 """ 195 def the_truth(): 196 if True: 197 print('To be, or not to be...') 198 else: 199 print('Booyah.') 200 """ 201 202 Scenario: Mark nested Python block with subsequent statements in outer block 203 Given I turn on python-mode 204 And there is no region selected 205 When I insert: 206 """ 207 def outer_foo(): 208 209 def inner_foo(): 210 return 23 211 212 return inner_foo() 213 214 """ 215 And I go to point "23" 216 And I press "C-@" 217 Then the region should be: 218 """ 219 def 220 """ 221 And I press "C-@" 222 Then the region should be: 223 """ 224 def inner_foo(): 225 """ 226 And I press "C-@" 227 Then the region should be: 228 """ 229 def inner_foo(): 230 return 23 231 """