1515# specific language governing permissions and limitations
1616# under the License.
1717
18+ from unittest .mock import patch
19+
1820import pyarrow as pa
1921import pytest
2022from pyspark .sql import SparkSession
21- from unittest .mock import patch
2223
2324from pyiceberg .catalog import Catalog
2425from pyiceberg .exceptions import CommitFailedException
@@ -34,7 +35,12 @@ def test_conflict_delete_delete(
3435) -> None :
3536 """This test should start passing once optimistic concurrency control has been implemented."""
3637 identifier = "default.test_conflict"
37- tbl1 = _create_table (session_catalog , identifier , {"format-version" : format_version , TableProperties .COMMIT_NUM_RETRIES : "1" }, [arrow_table_with_null ])
38+ tbl1 = _create_table (
39+ session_catalog ,
40+ identifier ,
41+ {"format-version" : format_version , TableProperties .COMMIT_NUM_RETRIES : "1" },
42+ [arrow_table_with_null ],
43+ )
3844 tbl2 = session_catalog .load_table (identifier )
3945
4046 tbl1 .delete ("string == 'z'" )
@@ -51,7 +57,12 @@ def test_conflict_delete_delete_with_retry(
5157) -> None :
5258 """This test should start passing once optimistic concurrency control has been implemented."""
5359 identifier = "default.test_conflict"
54- tbl1 = _create_table (session_catalog , identifier , {"format-version" : format_version , TableProperties .COMMIT_NUM_RETRIES : "2" }, [arrow_table_with_null ])
60+ tbl1 = _create_table (
61+ session_catalog ,
62+ identifier ,
63+ {"format-version" : format_version , TableProperties .COMMIT_NUM_RETRIES : "2" },
64+ [arrow_table_with_null ],
65+ )
5566 tbl2 = session_catalog .load_table (identifier )
5667
5768 tbl1 .delete ("string == 'z'" )
@@ -73,14 +84,20 @@ def mock_commit(
7384
7485 assert commit_count == 2
7586
87+
7688@pytest .mark .integration
7789@pytest .mark .parametrize ("format_version" , [1 , 2 ])
7890def test_conflict_delete_append (
7991 spark : SparkSession , session_catalog : Catalog , arrow_table_with_null : pa .Table , format_version : int
8092) -> None :
8193 """This test should start passing once optimistic concurrency control has been implemented."""
8294 identifier = "default.test_conflict"
83- tbl1 = _create_table (session_catalog , identifier , {"format-version" : format_version , TableProperties .COMMIT_NUM_RETRIES : "1" }, [arrow_table_with_null ])
95+ tbl1 = _create_table (
96+ session_catalog ,
97+ identifier ,
98+ {"format-version" : format_version , TableProperties .COMMIT_NUM_RETRIES : "1" },
99+ [arrow_table_with_null ],
100+ )
84101 tbl2 = session_catalog .load_table (identifier )
85102
86103 # This is allowed
@@ -98,7 +115,12 @@ def test_conflict_delete_append_with_retry(
98115) -> None :
99116 """This test should start passing once optimistic concurrency control has been implemented."""
100117 identifier = "default.test_conflict"
101- tbl1 = _create_table (session_catalog , identifier , {"format-version" : format_version , TableProperties .COMMIT_NUM_RETRIES : "2" }, [arrow_table_with_null ])
118+ tbl1 = _create_table (
119+ session_catalog ,
120+ identifier ,
121+ {"format-version" : format_version , TableProperties .COMMIT_NUM_RETRIES : "2" },
122+ [arrow_table_with_null ],
123+ )
102124 tbl2 = session_catalog .load_table (identifier )
103125
104126 # This is allowed
@@ -129,7 +151,12 @@ def test_conflict_append_delete(
129151) -> None :
130152 """This test should start passing once optimistic concurrency control has been implemented."""
131153 identifier = "default.test_conflict"
132- tbl1 = _create_table (session_catalog , identifier , {"format-version" : format_version , TableProperties .COMMIT_NUM_RETRIES : "1" }, [arrow_table_with_null ])
154+ tbl1 = _create_table (
155+ session_catalog ,
156+ identifier ,
157+ {"format-version" : format_version , TableProperties .COMMIT_NUM_RETRIES : "1" },
158+ [arrow_table_with_null ],
159+ )
133160 tbl2 = session_catalog .load_table (identifier )
134161
135162 tbl1 .append (arrow_table_with_null )
@@ -146,7 +173,12 @@ def test_conflict_append_delete_with_retry(
146173) -> None :
147174 """This test should start passing once optimistic concurrency control has been implemented."""
148175 identifier = "default.test_conflict"
149- tbl1 = _create_table (session_catalog , identifier , {"format-version" : format_version , TableProperties .COMMIT_NUM_RETRIES : "2" }, [arrow_table_with_null ])
176+ tbl1 = _create_table (
177+ session_catalog ,
178+ identifier ,
179+ {"format-version" : format_version , TableProperties .COMMIT_NUM_RETRIES : "2" },
180+ [arrow_table_with_null ],
181+ )
150182 tbl2 = session_catalog .load_table (identifier )
151183
152184 tbl1 .append (arrow_table_with_null )
@@ -176,7 +208,12 @@ def test_conflict_append_append(
176208) -> None :
177209 """This test should start passing once optimistic concurrency control has been implemented."""
178210 identifier = "default.test_conflict"
179- tbl1 = _create_table (session_catalog , identifier , {"format-version" : format_version , TableProperties .COMMIT_NUM_RETRIES : "1" }, [arrow_table_with_null ])
211+ tbl1 = _create_table (
212+ session_catalog ,
213+ identifier ,
214+ {"format-version" : format_version , TableProperties .COMMIT_NUM_RETRIES : "1" },
215+ [arrow_table_with_null ],
216+ )
180217 tbl2 = session_catalog .load_table (identifier )
181218
182219 tbl1 .append (arrow_table_with_null )
@@ -193,7 +230,12 @@ def test_conflict_append_append_with_retry(
193230) -> None :
194231 """This test should start passing once optimistic concurrency control has been implemented."""
195232 identifier = "default.test_conflict"
196- tbl1 = _create_table (session_catalog , identifier , {"format-version" : format_version , TableProperties .COMMIT_NUM_RETRIES : "2" }, [arrow_table_with_null ])
233+ tbl1 = _create_table (
234+ session_catalog ,
235+ identifier ,
236+ {"format-version" : format_version , TableProperties .COMMIT_NUM_RETRIES : "2" },
237+ [arrow_table_with_null ],
238+ )
197239 tbl2 = session_catalog .load_table (identifier )
198240
199241 tbl1 .append (arrow_table_with_null )
0 commit comments