Skip to content

Commit fd4755a

Browse files
add tests for external communication that should fail
1 parent b23e480 commit fd4755a

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

bpython/test/test_curtsies_painting.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ def test_startup(self):
3838

3939
def test_enter_text(self):
4040
[self.repl.add_normal_character(c) for c in '1 + 1']
41-
screen = fsarray([cyan('>>> ') + bold(blue('1')+cyan(' ')+
42-
yellow('+') + cyan(' ') + green('1')), cyan('welcome')])
41+
screen = fsarray([cyan('>>> ') + bold(green('1')+cyan(' ')+
42+
yellow('+') + cyan(' ') + green('1')), cyan('Welcome to')])
4343
self.assert_paint(screen, (0, 9))
4444

4545
def test_run_line(self):

bpython/test/test_curtsies_repl.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,28 @@
11
import unittest
22
import sys
3+
import os
34
py3 = (sys.version_info[0] == 3)
45

56
from bpython.curtsiesfrontend import repl
7+
from bpython import config
8+
9+
def setup_config(conf):
10+
config_struct = config.Struct()
11+
config.loadini(config_struct, os.devnull)
12+
for key, value in conf.items():
13+
if not hasattr(config_struct, key):
14+
raise ValueError("%r is not a valid config attribute", (key,))
15+
setattr(config_struct, key, value)
16+
return config_struct
617

718
class TestCurtsiesRepl(unittest.TestCase):
819

920
def setUp(self):
10-
self.repl = repl.Repl()
21+
self.config = setup_config({'editor':'true'})
22+
self.repl = repl.Repl(config=self.config)
23+
os.environ['PAGER'] = 'true'
24+
self.repl.width = 50
25+
self.repl.height = 20
1126

1227
def test_buffer_finished_will_parse(self):
1328
self.repl.buffer = ['1 + 1']
@@ -23,5 +38,11 @@ def test_buffer_finished_will_parse(self):
2338
self.repl.buffer = ['def foo(x):', ' return 1', '']
2439
self.assertTrue(self.repl.buffer_finished_will_parse(), (True, True))
2540

41+
def test_external_communication(self):
42+
self.assertEqual(type(self.repl.version_help_text()), type(b''))
43+
self.repl.send_current_block_to_external_editor()
44+
self.repl.send_session_to_external_editor()
45+
46+
2647
if __name__ == '__main__':
2748
unittest.main()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy