Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disabled logging, removed temporary prints, removed support for multiple statements #26

Merged
merged 6 commits into from
Jul 6, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions tests/sqltests.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from cs50.sql import SQL
import logging
import sys
import unittest
import warnings

from cs50.sql import SQL

class SQLTests(unittest.TestCase):
def multi_inserts_enabled(self):
return True
@@ -15,11 +17,6 @@ def test_delete_returns_affected_rows(self):
]
for row in rows:
self.db.execute("INSERT INTO cs50(val) VALUES(:val);", val=row["val"])

print(self.db.execute("DELETE FROM cs50 WHERE id = :id", id=rows[0]["id"]))
print(self.db.execute("SELECT * FROM cs50"))
return

self.assertEqual(self.db.execute("DELETE FROM cs50 WHERE id = :id", id=rows[0]["id"]), 1)
self.assertEqual(self.db.execute("DELETE FROM cs50 WHERE id = :a or id = :b", a=rows[1]["id"], b=rows[2]["id"]), 2)
self.assertEqual(self.db.execute("DELETE FROM cs50 WHERE id = -50"), 0)
@@ -122,5 +119,5 @@ def multi_inserts_enabled(self):
unittest.TestLoader().loadTestsFromTestCase(MySQLTests),
unittest.TestLoader().loadTestsFromTestCase(PostgresTests)
])

logging.getLogger("cs50.sql").disabled = True
sys.exit(not unittest.TextTestRunner(verbosity=2).run(suite).wasSuccessful())