Exemplo n.º 1
0
 def test_format_date_values(self):
     hearts = 'any string not need escaping or quoting; even this: ♥♥'
     cases = {
         '01/02/2000 12:34:56': '01/02/2000 12:34:56',
         hearts: hearts,
     }
     for (k, v) in cases.items():
         self.assertEqual((k, format_value(k, 'd')), (k, v))
 def test_format_date_values(self):
     hearts = 'any string not need escaping or quoting; even this: ♥♥'
     cases = {
         '01/02/2000 12:34:56': '01/02/2000 12:34:56',
         hearts: hearts,
     }
     for (k, v) in cases.items():
         self.assertEqual((k, format_value(k, 'd')), (k, v))
 def test_format_string_values(self):
     cases = {
         'a': '"a"',
         '': '""',
         'one "2" three': r'"one \"2\" three"',
         r'1\2\3': r'"1\\2\\3"',
     }
     for (k, v) in cases.items():
         self.assertEqual((k, format_value(k, 's')), (k, v))
 def test_format_numeric_values(self):
     cases = {
         '0': '0',
         '3': '3',
         '-1': '-1',
         '2.5': '2.5',
     }
     for (k, v) in cases.items():
         self.assertEqual((k, format_value(k, 'n')), (k, v))
Exemplo n.º 5
0
 def test_format_string_values(self):
     cases = {
         'a': '"a"',
         '': '""',
         'one "2" three': r'"one \"2\" three"',
         r'1\2\3': r'"1\\2\\3"',
     }
     for (k, v) in cases.items():
         self.assertEqual((k, format_value(k, 's')), (k, v))
Exemplo n.º 6
0
 def test_format_numeric_values(self):
     cases = {
         '0': '0',
         '3': '3',
         '-1': '-1',
         '2.5': '2.5',
     }
     for (k, v) in cases.items():
         self.assertEqual((k, format_value(k, 'n')), (k, v))
 def test_format_null_values(self):
     for dt in ('s', 'n', 'd', 'z'):
         # Note: even an illegal type, z, produces correct output for
         # null values.
         # Questionable, but we'll leave as a feature
         self.assertEqual(format_value(None, dt), '')
Exemplo n.º 8
0
 def test_format_null_values(self):
     for dt in ('s', 'n', 'd', 'z'):
         # Note: even an illegal type, z, produces correct output for
         # null values.
         # Questionable, but we'll leave as a feature
         self.assertEqual(format_value(None, dt), '')