Ejemplo n.º 1
0
class OutputTestCase(unittest.TestCase):
    def setUp(self):
        simple_csv_file = '{fixtures_dir}/simple.csv'.format(fixtures_dir=FIXTURES_DIR)
        self.actual = CsvImporter(simple_csv_file)

    def tearDown(self):
        del self.actual

    def test_print_columns(self):
        expected = '[\n    "col1",\n    "col2"\n]'
        assert self.actual.print_columns() == expected

    def test_print_rows(self):
        expected = '[\n    {\n        "col1": "a",\n        "col2": "b"\n    },\n    {\n        "col1": "c",\n        "col2": "d"\n    }\n]'
        assert self.actual.print_rows() == expected
def test_convert_into_utc_timestamp(date_str, fmt, tz, expected):
    assert CsvImporter.convert_into_utc_timestamp(date_str, fmt,
                                                  tz) == expected
def test_match_date_negativ(epoch_timestamp, date_str):
    assert CsvImporter.match_date(epoch_timestamp, date_str) is False
def test_match_date_positiv(epoch_timestamp, date_str):
    assert CsvImporter.match_date(epoch_timestamp, date_str) is True
 def setUp(self):
     simple_csv_file = '{fixtures_dir}/simple.csv'.format(
         fixtures_dir=FIXTURES_DIR)
     self.actual = CsvImporter(simple_csv_file)
 def setup_class(cls):
     temp_file = NamedTemporaryFile()
     cls.actual = CsvImporter(temp_file.name)
def test_convert_int_to_float(data, expected):
    assert CsvImporter.convert_int_to_float(data) == expected