-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check keyword arguments passed to Reader constructor. Throw an Assert…
…ionError if an invalid argument is passed. Before this change, specifying an invalid keyword argument would cause the AsyncConn to fail quietly in the Tornado default exception handler during run-time. Remove trailing whitespace Check keyword arguments in Writer constructor and add unit test
- Loading branch information
Stan Hu
committed
Jul 12, 2014
1 parent
ffeeac7
commit c2cd613
Showing
4 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import nsq | ||
import unittest | ||
|
||
|
||
class WriterUnitTest(unittest.TestCase): | ||
|
||
def setUp(self): | ||
super(WriterUnitTest, self).setUp() | ||
|
||
def test_constructor(self): | ||
name = 'test' | ||
reconnect_interval = 10.0 | ||
writer = nsq.Writer(nsqd_tcp_addresses=['127.0.0.1:4150'], | ||
reconnect_interval=reconnect_interval, | ||
name=name) | ||
self.assertEqual(writer.name, name) | ||
self.assertEqual(0, len(writer.conn_kwargs)) | ||
self.assertEqual(writer.reconnect_interval, reconnect_interval) | ||
|
||
def test_bad_writer_arguments(self): | ||
bad_options = dict(foo=10) | ||
|
||
self.assertRaises( | ||
AssertionError, | ||
nsq.Writer, | ||
nsqd_tcp_addresses=['127.0.0.1:4150'], | ||
reconnect_interval=15.0, | ||
name='test', **bad_options) |