mirror of
https://github.com/python/cpython.git
synced 2025-07-12 05:45:15 +00:00
gh-71339: Use new assertion methods in test_sqlite3 (GH-128830)
This commit is contained in:
parent
ff3e145b27
commit
75bd42c737
3 changed files with 22 additions and 33 deletions
|
@ -90,14 +90,14 @@ class InteractiveSession(unittest.TestCase):
|
|||
out, err = self.run_cli()
|
||||
self.assertIn(self.MEMORY_DB_MSG, err)
|
||||
self.assertIn(self.MEMORY_DB_MSG, err)
|
||||
self.assertTrue(out.endswith(self.PS1))
|
||||
self.assertEndsWith(out, self.PS1)
|
||||
self.assertEqual(out.count(self.PS1), 1)
|
||||
self.assertEqual(out.count(self.PS2), 0)
|
||||
|
||||
def test_interact_quit(self):
|
||||
out, err = self.run_cli(commands=(".quit",))
|
||||
self.assertIn(self.MEMORY_DB_MSG, err)
|
||||
self.assertTrue(out.endswith(self.PS1))
|
||||
self.assertEndsWith(out, self.PS1)
|
||||
self.assertEqual(out.count(self.PS1), 1)
|
||||
self.assertEqual(out.count(self.PS2), 0)
|
||||
|
||||
|
@ -105,7 +105,7 @@ class InteractiveSession(unittest.TestCase):
|
|||
out, err = self.run_cli(commands=(".version",))
|
||||
self.assertIn(self.MEMORY_DB_MSG, err)
|
||||
self.assertIn(sqlite3.sqlite_version + "\n", out)
|
||||
self.assertTrue(out.endswith(self.PS1))
|
||||
self.assertEndsWith(out, self.PS1)
|
||||
self.assertEqual(out.count(self.PS1), 2)
|
||||
self.assertEqual(out.count(self.PS2), 0)
|
||||
self.assertIn(sqlite3.sqlite_version, out)
|
||||
|
@ -114,14 +114,14 @@ class InteractiveSession(unittest.TestCase):
|
|||
out, err = self.run_cli(commands=("SELECT 1;",))
|
||||
self.assertIn(self.MEMORY_DB_MSG, err)
|
||||
self.assertIn("(1,)\n", out)
|
||||
self.assertTrue(out.endswith(self.PS1))
|
||||
self.assertEndsWith(out, self.PS1)
|
||||
self.assertEqual(out.count(self.PS1), 2)
|
||||
self.assertEqual(out.count(self.PS2), 0)
|
||||
|
||||
def test_interact_incomplete_multiline_sql(self):
|
||||
out, err = self.run_cli(commands=("SELECT 1",))
|
||||
self.assertIn(self.MEMORY_DB_MSG, err)
|
||||
self.assertTrue(out.endswith(self.PS2))
|
||||
self.assertEndsWith(out, self.PS2)
|
||||
self.assertEqual(out.count(self.PS1), 1)
|
||||
self.assertEqual(out.count(self.PS2), 1)
|
||||
|
||||
|
@ -130,7 +130,7 @@ class InteractiveSession(unittest.TestCase):
|
|||
self.assertIn(self.MEMORY_DB_MSG, err)
|
||||
self.assertIn(self.PS2, out)
|
||||
self.assertIn("(1,)\n", out)
|
||||
self.assertTrue(out.endswith(self.PS1))
|
||||
self.assertEndsWith(out, self.PS1)
|
||||
self.assertEqual(out.count(self.PS1), 2)
|
||||
self.assertEqual(out.count(self.PS2), 1)
|
||||
|
||||
|
@ -138,7 +138,7 @@ class InteractiveSession(unittest.TestCase):
|
|||
out, err = self.run_cli(commands=("sel;",))
|
||||
self.assertIn(self.MEMORY_DB_MSG, err)
|
||||
self.assertIn("OperationalError (SQLITE_ERROR)", err)
|
||||
self.assertTrue(out.endswith(self.PS1))
|
||||
self.assertEndsWith(out, self.PS1)
|
||||
self.assertEqual(out.count(self.PS1), 2)
|
||||
self.assertEqual(out.count(self.PS2), 0)
|
||||
|
||||
|
@ -147,7 +147,7 @@ class InteractiveSession(unittest.TestCase):
|
|||
|
||||
out, err = self.run_cli(TESTFN, commands=("CREATE TABLE t(t);",))
|
||||
self.assertIn(TESTFN, err)
|
||||
self.assertTrue(out.endswith(self.PS1))
|
||||
self.assertEndsWith(out, self.PS1)
|
||||
|
||||
out, _ = self.run_cli(TESTFN, commands=("SELECT count(t) FROM t;",))
|
||||
self.assertIn("(0,)\n", out)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue