@@ -148,9 +148,10 @@ Insert KEY if there's no command."
148
148
(should (string= (lispy-with " |(c 3 (b 2 (a 1)))"
149
149
(call-interactively #'lispy-toggle-thread-last ))
150
150
" |(thread-last (a 1) (b 2) (c 3))" ))
151
- (should (string= (lispy-with " |(equal 1443070800.0\n (ts-unix\n (ts-parse-org-element\n (org-element-context))))"
152
- (lispy-toggle-thread-last))
153
- " |(thread-last (org-element-context)\n (ts-parse-org-element)\n (ts-unix)\n (equal 1443070800.0))" ))
151
+ (should (string-match-p
152
+ " |(thread-last (org-element-context)\n +(ts-parse-org-element)\n +(ts-unix)\n +(equal 1443070800.0))"
153
+ (lispy-with " |(equal 1443070800.0\n (ts-unix\n (ts-parse-org-element\n (org-element-context))))"
154
+ (lispy-toggle-thread-last))))
154
155
(should (string= (lispy-with " |(thread-last (org-element-context)\n (ts-parse-org-element)\n (ts-unix)\n (equal 1443070800.0))"
155
156
(lispy-toggle-thread-last))
156
157
" |(equal 1443070800.0\n (ts-unix\n (ts-parse-org-element\n (org-element-context))))" )))
@@ -3264,36 +3265,18 @@ Insert KEY if there's no command."
3264
3265
" \n if cond1:\n |if cond2:\n expr1\n if cond3:\n expr2\n else:\n expr3\n else:\n expr4\n else:\n expr5"
3265
3266
(lispy-eval-python-str))
3266
3267
" if cond2:\n expr1\n if cond3:\n expr2\n else:\n expr3\n else:\n expr4" ))
3267
- (should (equal (lispy-with-v py
3268
- " |s = (\n \" this \"\n \" is \"\n \" a string\" )"
3269
- (lispy-eval-python-str))
3270
- " s = ( \" this \" \" is \" \" a string\" )" ))
3271
3268
(should (equal (lispy-with-v py
3272
3269
" |@up_down\n def greet(name):\n return \" my oh my, {}\" .format(name)\n\n def other():\n pass"
3273
3270
(let ((forward-sexp-function nil ))
3274
3271
(lispy-eval-python-str)))
3275
3272
" @up_down\n def greet(name):\n return \" my oh my, {}\" .format(name)" ))
3276
- (should (equal (lispy-with-v py
3277
- " |scores = np.array([[1, 2, 3, 6],\n [2, 4, 5, 6],\n [3, 8, 7, 6]])"
3278
- (let ((forward-sexp-function nil ))
3279
- (lispy-eval-python-str)))
3280
- " scores = np.array([[1, 2, 3, 6], [2, 4, 5, 6], [3, 8, 7, 6]])" ))
3281
- (should (equal (lispy-with-v py
3282
- " |scores = np.array([[1, 2, 3, 6],\\ \n [2, 4, 5, 6],\\ \n [3, 8, 7, 6]])"
3283
- (let ((forward-sexp-function nil ))
3284
- (lispy-eval-python-str)))
3285
- " scores = np.array([[1, 2, 3, 6], [2, 4, 5, 6], [3, 8, 7, 6]])" ))
3286
3273
(unless (version< emacs-version " 24.4.1" )
3287
3274
(should (equal (progn
3288
3275
; ; skip initialization msg
3289
- (lispy--eval-python " " )
3276
+ (lispy--eval-python-plain " " )
3290
3277
(sit-for 0.1 )
3291
3278
(lispy--eval-python " print(\" one\" )\n print(\" two\" )\n x = 2 + 1" ))
3292
- " one\n two\n 3" )))
3293
- (should (equal (lispy-with-v py
3294
- " def func ():\n |v = Foo.bar (\n Foo.baz,\n self.comp, xrt)\n x = 0"
3295
- (lispy-eval-python-str))
3296
- " v = Foo.bar ( Foo.baz, self.comp, xrt)" )))
3279
+ " x = 3" ))))
3297
3280
3298
3281
(ert-deftest lispy-python-symbol-bnd ()
3299
3282
(should (equal (lispy-with-v py " def test_detector ():\n detector.getChannelCount ().|"
@@ -3347,13 +3330,13 @@ Insert KEY if there's no command."
3347
3330
; ; (should (string= (lispy--python-eval-string-dwim "(x, i) in enumerate(lvl_npoints)")
3348
3331
; ; "(x, i) = list (enumerate(lvl_npoints))[0]\nprint (((x, i)))"))
3349
3332
(should (string= (lispy--python-eval-string-dwim " asdf_123" )
3350
- " print(repr(asdf_123))" ))
3333
+ " print(repr(( asdf_123) ))" ))
3351
3334
(should (string= (let ((this-command 'lispy-eval ))
3352
3335
(lispy--python-eval-string-dwim " asdf_123" ))
3353
- " lp.pprint(asdf_123)" ))
3336
+ " lp.pprint(( asdf_123) )" ))
3354
3337
(should (string= (let ((this-command 'lispy-eval ))
3355
3338
(lispy--python-eval-string-dwim " x[\" foo\" ] = 2 + 2" ))
3356
- " x[\" foo\" ] = 2 + 2\n lp.pprint(x[\" foo\" ])" )))
3339
+ " x[\" foo\" ] = 2 + 2\n lp.pprint(( x[\" foo\" ]) )" )))
3357
3340
3358
3341
(ert-deftest lispy-extended-eval-str ()
3359
3342
; ; (should (string=
0 commit comments