예제 #1
0
 def test_cr_newline(self):
     tftp.netascii.NL = b'\x0d'
     self.assertEqual(from_netascii(b'\x0d\x00'), b'\x0d')
     self.assertEqual(from_netascii(b'\x0d\x0a'), b'\x0d')
     self.assertEqual(from_netascii(b'foo\x0d\x0a\x0abar'), b'foo\x0d\x0abar')
     self.assertEqual(from_netascii(b'foo\x0d\x0a\x00bar'), b'foo\x0d\x00bar')
     self.assertEqual(from_netascii(b'foo\x0d\x00\x0abar'), b'foo\x0d\x0abar')
예제 #2
0
 def test_cr_newline(self):
     tftp.netascii.NL = '\x0d'
     self.assertEqual(from_netascii('\x0d\x00'), '\x0d')
     self.assertEqual(from_netascii('\x0d\x0a'), '\x0d')
     self.assertEqual(from_netascii('foo\x0d\x0a\x0abar'), 'foo\x0d\x0abar')
     self.assertEqual(from_netascii('foo\x0d\x0a\x00bar'), 'foo\x0d\x00bar')
     self.assertEqual(from_netascii('foo\x0d\x00\x0abar'), 'foo\x0d\x0abar')
예제 #3
0
 def test_lf_newline(self):
     tftp.netascii.NL = b'\x0a'
     self.assertEqual(from_netascii(b'\x0d\x00'), b'\x0d')
     self.assertEqual(from_netascii(b'\x0d\x0a'), b'\x0a')
     self.assertEqual(from_netascii(b'foo\x0d\x0a\x0abar'), b'foo\x0a\x0abar')
     self.assertEqual(from_netascii(b'foo\x0d\x0a\x0abar'), b'foo\x0a\x0abar')
     # freestanding CR should not occur, but handle it anyway
     self.assertEqual(from_netascii(b'foo\x0d\x0a\x0dbar'), b'foo\x0a\x0dbar')
예제 #4
0
 def test_lf_newline(self):
     tftp.netascii.NL = '\x0a'
     self.assertEqual(from_netascii('\x0d\x00'), '\x0d')
     self.assertEqual(from_netascii('\x0d\x0a'), '\x0a')
     self.assertEqual(from_netascii('foo\x0d\x0a\x0abar'), 'foo\x0a\x0abar')
     self.assertEqual(from_netascii('foo\x0d\x0a\x0abar'), 'foo\x0a\x0abar')
     # freestanding CR should not occur, but handle it anyway
     self.assertEqual(from_netascii('foo\x0d\x0a\x0dbar'), 'foo\x0a\x0dbar')
예제 #5
0
 def test_crlf_newline(self):
     tftp.netascii.NL = b'\x0d\x0a'
     self.assertEqual(from_netascii(b'\x0d\x00'), b'\x0d')
     self.assertEqual(from_netascii(b'\x0d\x0a'), b'\x0d\x0a')
     self.assertEqual(from_netascii(b'foo\x0d\x00\x0abar'),
                      b'foo\x0d\x0abar')
예제 #6
0
 def test_crlf_newline(self):
     tftp.netascii.NL = '\x0d\x0a'
     self.assertEqual(from_netascii('\x0d\x00'), '\x0d')
     self.assertEqual(from_netascii('\x0d\x0a'), '\x0d\x0a')
     self.assertEqual(from_netascii('foo\x0d\x00\x0abar'), 'foo\x0d\x0abar')