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)