def test_dict_key_completion_bytes():
 ip = get_ipython()
 complete = ip.Completer.complete
 ip.user_ns['d'] = {'abc': None, 'abd': None}
 (_, matches) = complete(line_buffer='d[')
 nt.assert_in("'abc'", matches)
 nt.assert_in("b'abd'", matches)
 if False:
  (_, matches) = complete(line_buffer='d[b')
  nt.assert_in("b'abd'", matches)
  nt.assert_not_in("b'abc'", matches)
  (_, matches) = complete(line_buffer="d[b'")
  nt.assert_in('abd', matches)
  nt.assert_not_in('abc', matches)
  (_, matches) = complete(line_buffer="d[B'")
  nt.assert_in('abd', matches)
  nt.assert_not_in('abc', matches)
  (_, matches) = complete(line_buffer="d['")
  nt.assert_in('abc', matches)
  nt.assert_not_in('abd', matches)

def test_dict_key_completion_bytes ( ) : ip = get_ipython ( ) complete = ip . Completer . complete ip . user_ns [ 'd' ] = { 'abc' : None , 'abd' : None } ( _ , matches ) = complete ( line_buffer = 'd[' ) nt . assert_in ( "'abc'" , matches ) nt . assert_in ( "b'abd'" , matches ) if False : ( _ , matches ) = complete ( line_buffer = 'd[b' ) nt . assert_in ( "b'abd'" , matches ) nt . assert_not_in ( "b'abc'" , matches ) ( _ , matches ) = complete ( line_buffer = "d[b'" ) nt . assert_in ( 'abd' , matches ) nt . assert_not_in ( 'abc' , matches ) ( _ , matches ) = complete ( line_buffer = "d[B'" ) nt . assert_in ( 'abd' , matches ) nt . assert_not_in ( 'abc' , matches ) ( _ , matches ) = complete ( line_buffer = "d['" ) nt . assert_in ( 'abc' , matches ) nt . assert_not_in ( 'abd' , matches )
test handling of bytes in dict key completion .