Exemple #1
0
def test_unescape_decodes_latin1_to_unicode():
  assert type(jprops._unescape(b'\xff')) == text_type
  assert type(jprops._unescape(b'\x80')) == text_type
Exemple #2
0
def test_unescape(value, expected):
  actual = jprops._unescape(value)
  assert actual == expected
  assert type(actual) == type(expected)
Exemple #3
0
def test_unescape_decodes_latin1_to_unicode():
  eq_(text_type, type(jprops._unescape(b'\xff')))
  eq_(text_type, type(jprops._unescape(b'\x80')))
Exemple #4
0
def test_unescape_unicode():
    eq_(u'\u00ff', jprops._unescape(br'\u00ff'))
Exemple #5
0
def test_unescape_unicode():
  eq_(u'\u00ff', jprops._unescape(br'\u00ff'))
Exemple #6
0
def test_unescape_unicode_escaped():
  eq_(r'\u00ff', jprops._unescape(br'\\u00ff'))
  eq_(u'\\\u00ff', jprops._unescape(br'\\\u00ff'))
  eq_(r'\\u00ff', jprops._unescape(br'\\\\u00ff'))
Exemple #7
0
def test_unescape_basic():
  assert jprops._unescape(b'\\t') == '\t'
  assert jprops._unescape(b'\\n') == '\n'
  assert jprops._unescape(b'\\f') == '\f'
  assert jprops._unescape(b'\\r') == '\r'
Exemple #8
0
def test_unescape_decodes_latin1_to_unicode():
  eq_(unicode, type(jprops._unescape('\xff')))
  eq_(unicode, type(jprops._unescape(chr(128))))
Exemple #9
0
def test_unescape_decodes_latin1_to_unicode():
    eq_(text_type, type(jprops._unescape(b'\xff')))
    eq_(text_type, type(jprops._unescape(b'\x80')))
Exemple #10
0
def test_unescape_basic():
    eq_('\t', jprops._unescape(b'\\t'))
    eq_('\n', jprops._unescape(b'\\n'))
    eq_('\f', jprops._unescape(b'\\f'))
    eq_('\r', jprops._unescape(b'\\r'))
Exemple #11
0
def test_unescape_decodes_ascii_to_native_string():
    eq_(str, type(jprops._unescape(b'x')))
    eq_(str, type(jprops._unescape(b'\x7f')))
Exemple #12
0
def test_unescape_unicode_escaped():
    eq_(r'\u00ff', jprops._unescape(br'\\u00ff'))
    eq_(u'\\\u00ff', jprops._unescape(br'\\\u00ff'))
    eq_(r'\\u00ff', jprops._unescape(br'\\\\u00ff'))
Exemple #13
0
def test_unescape_unicode_encoded_backslassh():
    eq_(u'\\b', jprops._unescape(br'\u005cb'))
Exemple #14
0
def test_unescape(value, expected):
    actual = jprops._unescape(value)
    assert actual == expected
    assert type(actual) == type(expected)
Exemple #15
0
def test_unescape_unrecognized():
  assert jprops._unescape(br'\=') == '='
  assert jprops._unescape(br'\:') == ':'
  assert jprops._unescape(br'\b') == 'b'
Exemple #16
0
def test_unescape_decodes_ascii_to_str():
  eq_(str, type(jprops._unescape('x')))
  eq_(str, type(jprops._unescape(chr(127))))
Exemple #17
0
def test_unescape_unicode():
  assert jprops._unescape(br'\u00ff') == u'\u00ff'
Exemple #18
0
def test_unescape_unrecognized():
  eq_('=', jprops._unescape(br'\='))
  eq_(':', jprops._unescape(br'\:'))
  eq_('b', jprops._unescape(br'\b'))
Exemple #19
0
def test_unescape_unicode_encoded_backslassh():
  assert jprops._unescape(br'\u005cb') == u'\\b'
Exemple #20
0
def test_unescape_unicode_encoded_backslassh():
  eq_(u'\\b', jprops._unescape(br'\u005cb'))
Exemple #21
0
def test_unescape_unicode_escaped():
  assert jprops._unescape(br'\\u00ff') == r'\u00ff'
  assert jprops._unescape(br'\\\u00ff') == u'\\\u00ff'
  assert jprops._unescape(br'\\\\u00ff') == r'\\u00ff'
Exemple #22
0
def test_unescape_decodes_ascii_to_native_string():
  eq_(str, type(jprops._unescape(b'x')))
  eq_(str, type(jprops._unescape(b'\x7f')))
Exemple #23
0
def test_unescape_decodes_ascii_to_native_string():
  assert type(jprops._unescape(b'x')) == str
  assert type(jprops._unescape(b'\x7f')) == str
Exemple #24
0
def test_unescape_basic():
  eq_('\t', jprops._unescape(b'\\t'))
  eq_('\n', jprops._unescape(b'\\n'))
  eq_('\f', jprops._unescape(b'\\f'))
  eq_('\r', jprops._unescape(b'\\r'))
Exemple #25
0
def test_unescape_unrecognized():
    eq_('=', jprops._unescape(br'\='))
    eq_(':', jprops._unescape(br'\:'))
    eq_('b', jprops._unescape(br'\b'))