12345678910111213141516171819202122232425262728293031323334353637 |
- import unittest
- from misc.csv_cleanup import cleanup_line
- class TestCsvCleanup(unittest.TestCase):
- def test_cleanup_line_ident(self):
- simple_int = "1;2;3\n"
- simple_float = "1,20;2,322;3,434\n"
- simple_string = '"Test";"Default";"Simple Test"\n'
- self.assertEqual(cleanup_line(simple_int), simple_int)
- self.assertEqual(cleanup_line(simple_float), simple_float)
- self.assertEqual(cleanup_line(simple_string), simple_string)
- def test_cleanup_line_semicolon(self):
- string_1_in = '"String 1";"String;2";"Test 3"\n'
- string_1_out = '"String 1";"String2";"Test 3"\n'
- string_2_in = '"1;2;3"\n'
- string_2_out = '"123"\n'
- string_3_in = '"1";";";3\n'
- string_3_out = '"1";"";3\n'
- string_4_in = '";;;;;;;"\n'
- string_4_out = '""\n'
- string_5_in = '"";"";"";"";";;;"\n'
- string_5_out = '"";"";"";"";""\n'
- self.assertEqual(cleanup_line(string_1_in), string_1_out)
- self.assertEqual(cleanup_line(string_2_in), string_2_out)
- self.assertEqual(cleanup_line(string_3_in), string_3_out)
- self.assertEqual(cleanup_line(string_4_in), string_4_out)
- self.assertEqual(cleanup_line(string_5_in), string_5_out)
|