def setup(self): """ Set up the unit test suite. .. versionadded:: 0.2.0 """ self.proxy = MockResultProxy([1, 2, 3])
def test_one(self): """ Test that extracting one result from the proxy works as expected. .. versionadded:: 0.2.0 .. versionchanged:: 0.3.0 Changed to check for None on call to one() when empty. """ assert_equals(self.proxy.one(), 1) # test that the behavior is correct when we're working with an empty proxy self.empty = MockResultProxy() assert_equals(self.empty.one(), None)
def test_first(self): """ Test that the first result in the proxy is returned. .. versionadded:: 0.2.0 .. versionchanged:: 0.3.0 Changed to check for None on call to first() when empty. """ assert_equals(self.proxy.first(), 1) # test that the behavior is correct when we're working with an empty proxy self.empty = MockResultProxy() assert_equals(self.empty.first(), None)
class TestMockResultProxy(object): """ Nose unit test suite for Probe MockResultProxy. .. versionadded:: 0.2.0 """ def setup(self): """ Set up the unit test suite. .. versionadded:: 0.2.0 """ self.proxy = MockResultProxy([1, 2, 3]) def teardown(self): """ Tear down the unit test suite. .. versionadded:: 0.2.0 """ pass def test_init(self): """ Verify the result proxy has been initialised correctly. .. versionadded:: 0.2.0 """ assert_equals(self.proxy.data, [1, 2, 3]) def test_first(self): """ Test that the first result in the proxy is returned. .. versionadded:: 0.2.0 .. versionchanged:: 0.3.0 Changed to check for None on call to first() when empty. """ assert_equals(self.proxy.first(), 1) # test that the behavior is correct when we're working with an empty proxy self.empty = MockResultProxy() assert_equals(self.empty.first(), None) def test_options(self): """ Test that calling options just returns self. .. versionadded:: 0.3.0 """ assert_equals(self.proxy.options(), self.proxy) assert_equals(self.proxy.options(1,"random",3), self.proxy) def test_one(self): """ Test that extracting one result from the proxy works as expected. .. versionadded:: 0.2.0 .. versionchanged:: 0.3.0 Changed to check for None on call to one() when empty. """ assert_equals(self.proxy.one(), 1) # test that the behavior is correct when we're working with an empty proxy self.empty = MockResultProxy() assert_equals(self.empty.one(), None) def test_all(self): """ Test that all of the results in the proxy are returned. .. versionadded:: 0.2.0 """ assert_equals(self.proxy.all(), [1, 2, 3])
class TestMockResultProxy(object): """ Nose unit test suite for Probe MockResultProxy. .. versionadded:: 0.2.0 """ def setup(self): """ Set up the unit test suite. .. versionadded:: 0.2.0 """ self.proxy = MockResultProxy([1, 2, 3]) def teardown(self): """ Tear down the unit test suite. .. versionadded:: 0.2.0 """ pass def test_init(self): """ Verify the result proxy has been initialised correctly. .. versionadded:: 0.2.0 """ assert_equals(self.proxy.data, [1, 2, 3]) def test_first(self): """ Test that the first result in the proxy is returned. .. versionadded:: 0.2.0 .. versionchanged:: 0.3.0 Changed to check for None on call to first() when empty. """ assert_equals(self.proxy.first(), 1) # test that the behavior is correct when we're working with an empty proxy self.empty = MockResultProxy() assert_equals(self.empty.first(), None) def test_options(self): """ Test that calling options just returns self. .. versionadded:: 0.3.0 """ assert_equals(self.proxy.options(), self.proxy) assert_equals(self.proxy.options(1, "random", 3), self.proxy) def test_one(self): """ Test that extracting one result from the proxy works as expected. .. versionadded:: 0.2.0 .. versionchanged:: 0.3.0 Changed to check for None on call to one() when empty. """ assert_equals(self.proxy.one(), 1) # test that the behavior is correct when we're working with an empty proxy self.empty = MockResultProxy() assert_equals(self.empty.one(), None) def test_all(self): """ Test that all of the results in the proxy are returned. .. versionadded:: 0.2.0 """ assert_equals(self.proxy.all(), [1, 2, 3])