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

assert method for None checks #2

Merged
merged 3 commits into from
Sep 1, 2016
Merged
Changes from all commits
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
12 changes: 6 additions & 6 deletions tests/storage_adapter_tests/test_sqlalchemy_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_statement_not_found(self):
Test that None is returned by the find method
when a matching statement is not found.
"""
self.assertEqual(self.adapter.find("Non-existant"), None)
self.assertIsNone(self.adapter.find("Non-existant"))

def test_statement_found(self):
"""
Expand All @@ -43,15 +43,15 @@ def test_statement_found(self):
self.adapter.update(statement)

found_statement = self.adapter.find("New statement")
self.assertNotEqual(found_statement, None)
self.assertIsNotNone(found_statement)
self.assertEqual(found_statement.text, statement.text)

def test_update_adds_new_statement(self):
statement = Statement("New statement")
self.adapter.update(statement)

statement_found = self.adapter.find("New statement")
self.assertNotEqual(statement_found, None)
self.assertIsNotNone(statement_found)
self.assertEqual(statement_found.text, statement.text)

def test_update_modifies_existing_statement(self):
Expand Down Expand Up @@ -194,7 +194,7 @@ def test_get_response_statements(self):

class SQLAlchemyStorageAdapterFilterTestCase(SQLAlchemyAdapterTestCase):
def setUp(self):
super(SQLAlchemyAdapterTestCase, self).setUp()
super(SQLAlchemyStorageAdapterFilterTestCase, self).setUp()

self.statement1 = Statement(
"Testing...",
Expand Down Expand Up @@ -329,7 +329,7 @@ def test_response_list_in_results(self):
found = self.adapter.filter(text=statement.text)

self.assertEqual(len(found[0].in_response_to), 1)
self.assertEqual(type(found[0].in_response_to[0]), Response)
self.assertIsInstance(found[0].in_response_to[0], Response)


class ReadOnlySQLAlchemyDataabaseAdapterTestCase(SQLAlchemyAdapterTestCase):
Expand All @@ -340,7 +340,7 @@ def test_update_does_not_add_new_statement(self):
self.adapter.update(statement)

statement_found = self.adapter.find("New statement")
self.assertEqual(statement_found, None)
self.assertIsNone(statement_found)

def test_update_does_not_modify_existing_statement(self):
statement = Statement("New statement")
Expand Down