Exemplo n.º 1
0
    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())
Exemplo n.º 2
0
    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())
Exemplo n.º 3
0
    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())
Exemplo n.º 4
0
    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())
Exemplo n.º 5
0
 def test_passes_on_nonempty_list(self):
     """Test that assert_not_empty passes on a nonempty list."""
     assertions.assert_not_empty([0])
Exemplo n.º 6
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([])
Exemplo n.º 7
0
 def test_passes_on_nonempty_tuple(self):
     """Test that assert_not_empty passes on a nonempty tuple."""
     assertions.assert_not_empty((0, ))
Exemplo n.º 8
0
 def test_fails_on_empty_tuple(self):
     with assertions.assert_raises(AssertionError):
         assertions.assert_not_empty(())
Exemplo n.º 9
0
 def test_passes_on_nonempty_list(self):
     """Test that assert_not_empty passes on a nonempty list."""
     assertions.assert_not_empty([0])
Exemplo n.º 10
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([])
Exemplo n.º 11
0
 def test_passes_on_nonempty_tuple(self):
     """Test that assert_not_empty passes on a nonempty tuple."""
     assertions.assert_not_empty((0,))
Exemplo n.º 12
0
 def test_fails_on_empty_tuple(self):
     with assertions.assert_raises(AssertionError):
         assertions.assert_not_empty(())