Inserting row with duplicated PK
()
| 42 | |
| 43 | |
| 44 | def test_duplicated_pk(): |
| 45 | """Inserting row with duplicated PK""" |
| 46 | # https://github.com/PyMySQL/mysqlclient/issues/535 |
| 47 | table_name = "test_duplicated_pk" |
| 48 | conn = connect() |
| 49 | cursor = conn.cursor() |
| 50 | |
| 51 | cursor.execute(f"create table {table_name} (c1 int primary key)") |
| 52 | _tables.append(table_name) |
| 53 | |
| 54 | cursor.execute(f"insert into {table_name} values (1)") |
| 55 | with pytest.raises(MySQLdb.IntegrityError): |
| 56 | cursor.execute(f"insert into {table_name} values (1)") |