def test_passes_on_infinite_generator(self): """Tests that assert_not_empty fails on an infinite generator.""" def yes(): while True: yield 'y' assertions.assert_not_empty(yes())
def test_fails_on_unyielding_generator(self): """Test that assert_not_empty fails on an 'empty' generator.""" def yield_nothing(): if False: yield 0 with assertions.assert_raises(AssertionError): assertions.assert_not_empty(yield_nothing())
def test_passes_on_nonempty_list(self): """Test that assert_not_empty passes on a nonempty list.""" assertions.assert_not_empty([0])
def test_fails_on_empty_list(self): """Test that assert_not_empty fails on an empty list.""" with assertions.assert_raises(AssertionError): assertions.assert_not_empty([])
def test_passes_on_nonempty_tuple(self): """Test that assert_not_empty passes on a nonempty tuple.""" assertions.assert_not_empty((0, ))
def test_fails_on_empty_tuple(self): with assertions.assert_raises(AssertionError): assertions.assert_not_empty(())
def test_passes_on_nonempty_tuple(self): """Test that assert_not_empty passes on a nonempty tuple.""" assertions.assert_not_empty((0,))