MCPcopy Create free account
hub / github.com/PyMySQL/mysqlclient / test_null

Function test_null

tests/test_errors.py:30–41  ·  view source on GitHub ↗

Inserting NULL into non NULLABLE column

()

Source from the content-addressed store, hash-verified

28
29
30def test_null():
31 """Inserting NULL into non NULLABLE column"""
32 # https://github.com/PyMySQL/mysqlclient/issues/535
33 table_name = "test_null"
34 conn = connect()
35 cursor = conn.cursor()
36
37 cursor.execute(f"create table {table_name} (c1 int primary key)")
38 _tables.append(table_name)
39
40 with pytest.raises(MySQLdb.IntegrityError):
41 cursor.execute(f"insert into {table_name} values (null)")
42
43
44def test_duplicated_pk():

Callers

nothing calls this directly

Calls 3

cursorMethod · 0.80
executeMethod · 0.80
connectFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…