Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed usage of assertIsInstance since it's only available in Python…

… 2.7+.
  • Loading branch information...
commit 25a313be0c2fa5a2fad4b014667c335fe543dcbc 1 parent 57aef76
@3ft9 3ft9 authored
Showing with 1 addition and 15 deletions.
  1. +1 −0  .gitignore
  2. +0 −11 tests/test_definition.py
  3. +0 −4 tests/test_user.py
View
1  .gitignore
@@ -4,3 +4,4 @@
*egg-info*
*~
dist/
+sftp-config.json
View
11 tests/test_definition.py
@@ -16,12 +16,10 @@ def setUp(self):
def test_construction(self):
definition = datasift.Definition(self.user)
- self.assertIsInstance(definition, datasift.Definition, 'Definition construction failed')
self.assertEqual(definition.get(), '', 'Default definition CSDL is not empty')
def test_construction_with_definition(self):
definition = datasift.Definition(self.user, testdata.definition)
- self.assertIsInstance(definition, datasift.Definition, 'Definition construction failed')
self.assertEqual(definition.get(), testdata.definition, 'Definition CSDL not set correctly')
def test_construction_invalid_user(self):
@@ -60,7 +58,6 @@ def test_compile_success(self):
self.mock_api_client.set_response(response)
definition = datasift.Definition(self.user, testdata.definition)
- self.assertIsInstance(definition, datasift.Definition, 'Definition construction failed')
self.assertEqual(definition.get(), testdata.definition, 'Definition CSDL not set correctly')
try:
@@ -90,7 +87,6 @@ def test_compile_failure(self):
self.mock_api_client.set_response(response)
definition = datasift.Definition(self.user, testdata.invalid_definition)
- self.assertIsInstance(definition, datasift.Definition, 'Definition construction failed')
self.assertEqual(definition.get(), testdata.invalid_definition, 'Definition CSDL not set correctly')
try:
@@ -117,7 +113,6 @@ def test_compile_success_then_failure(self):
self.mock_api_client.set_response(response)
definition = datasift.Definition(self.user, testdata.definition)
- self.assertIsInstance(definition, datasift.Definition, 'Definition construction failed')
self.assertEqual(definition.get(), testdata.definition, 'Definition CSDL not set correctly')
try:
@@ -171,7 +166,6 @@ def test_get_created_at(self):
self.mock_api_client.set_response(response)
definition = datasift.Definition(self.user, testdata.definition)
- self.assertIsInstance(definition, datasift.Definition, 'Definition construction failed')
self.assertEqual(definition.get(), testdata.definition, 'Definition CSDL not set correctly')
self.assertEqual(definition.get_created_at(), datetime.strptime(response['data']['created_at'], '%Y-%m-%d %H:%M:%S'), 'Incorrect created at date')
@@ -189,7 +183,6 @@ def test_get_total_dpu(self):
self.mock_api_client.set_response(response)
definition = datasift.Definition(self.user, testdata.definition)
- self.assertIsInstance(definition, datasift.Definition, 'Definition construction failed')
self.assertEqual(definition.get(), testdata.definition, 'Definition CSDL not set correctly')
self.assertEqual(definition.get_total_dpu(), response['data']['dpu'], 'Incorrect total DPU')
@@ -208,7 +201,6 @@ def test_get_dpu_breakdown(self):
self.mock_api_client.set_response(response)
definition = datasift.Definition(self.user, testdata.definition)
- self.assertIsInstance(definition, datasift.Definition, 'Definition construction failed')
self.assertEqual(definition.get(), testdata.definition, 'Definition CSDL not set correctly')
self.assertEqual(definition.get_hash(), response['data']['hash'], 'Incorrect hash')
@@ -278,7 +270,6 @@ def test_get_buffered(self):
self.mock_api_client.set_response(response)
definition = datasift.Definition(self.user, testdata.definition)
- self.assertIsInstance(definition, datasift.Definition, 'Definition construction failed')
self.assertEqual(definition.get(), testdata.definition, 'Definition CSDL not set correctly')
self.assertEqual(definition.get_hash(), response['data']['hash'], 'Incorrect hash')
@@ -367,13 +358,11 @@ def test_get_consumer(self):
self.mock_api_client.set_response(response)
definition = datasift.Definition(self.user, testdata.definition)
- self.assertIsInstance(definition, datasift.Definition, 'Definition construction failed')
self.assertEqual(definition.get(), testdata.definition, 'Definition CSDL not set correctly')
self.assertEqual(definition.get_hash(), response['data']['hash'], 'Incorrect hash')
consumer = definition.get_consumer(datasift.StreamConsumerEventHandler())
- self.assertIsInstance(consumer, datasift.StreamConsumer, 'Failed to get a StreamConsumer object')
if __name__ == '__main__':
unittest.main()
View
4 tests/test_user.py
@@ -15,23 +15,19 @@ def setUp(self):
self.user.set_api_client(self.mock_api_client)
def test_construction(self):
- self.assertIsInstance(self.user, datasift.User, 'User construction failed')
self.assertEqual(self.user.get_username(), testdata.username, 'Username is incorrect')
self.assertEqual(self.user.get_api_key(), testdata.api_key, 'API key is incorrect')
def test_create_definition_empty(self):
definition = self.user.create_definition()
- self.assertIsInstance(definition, datasift.Definition, 'Failed to create an empty definition')
self.assertEqual(definition.get(), '', 'Definition is not empty')
def test_create_definition_unicode(self):
definition = self.user.create_definition(testdata.unicode_definition)
- self.assertIsInstance(definition, datasift.Definition, 'Failed to create a non-empty definition')
self.assertEqual(definition.get(), testdata.definition, 'Definition is incorrect')
def test_create_definition_nonempty(self):
definition = self.user.create_definition(testdata.definition)
- self.assertIsInstance(definition, datasift.Definition, 'Failed to create a non-empty definition')
self.assertEqual(definition.get(), testdata.definition, 'Definition is incorrect')
def test_rate_limits(self):
Please sign in to comment.
Something went wrong with that request. Please try again.