def test_iter_metadata__no_etag(self):
     string_io = StringIOContextManager("ROW_ID,ROW_VERSION,asdf\n"
                                        "1,2,\"I like trains\"\n"
                                        "5,1,\"weeeeeeeeeeee\"\n")
     with patch.object(io, "open", return_value=string_io):
         csv_file_table = CsvFileTable("syn123", "/fake/file/path")
         metadata = [x for x in csv_file_table.iter_row_metadata()]
         assert_equals(2, len(metadata))
         assert_equals((1, 2, None), metadata[0])
         assert_equals((5, 1, None), metadata[1])
Пример #2
0
 def test_iter_metadata__no_etag(self):
     string_io = StringIOContextManager("ROW_ID,ROW_VERSION,asdf\n"
                                        "1,2,\"I like trains\"\n"
                                        "5,1,\"weeeeeeeeeeee\"\n")
     with patch.object(io, "open", return_value=string_io):
         csv_file_table = CsvFileTable("syn123", "/fake/file/path")
         metadata = [x for x in csv_file_table.iter_row_metadata()]
         assert_equals(2, len(metadata))
         assert_equals((1, 2, None), metadata[0])
         assert_equals((5, 1, None), metadata[1])
 def test_iter_metadata__has_etag(self):
     string_io = StringIOContextManager("ROW_ID,ROW_VERSION,ROW_ETAG,asdf\n"
                                        "1,2,etag1,\"I like trains\"\n"
                                        "5,1,etag2,\"weeeeeeeeeeee\"\n")
     with patch.object(io, "open", return_value=string_io):
         csv_file_table = CsvFileTable("syn123", "/fake/file/path")
         metadata = [x for x in csv_file_table.iter_row_metadata()]
         assert 2 == len(metadata)
         assert (1, 2, "etag1") == metadata[0]
         assert (5, 1, "etag2") == metadata[1]