Beispiel #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())
Beispiel #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())
Beispiel #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())
Beispiel #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())
Beispiel #5
0
 def test_passes_on_nonempty_list(self):
     """Test that assert_not_empty passes on a nonempty list."""
     assertions.assert_not_empty([0])
Beispiel #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([])
Beispiel #7
0
 def test_passes_on_nonempty_tuple(self):
     """Test that assert_not_empty passes on a nonempty tuple."""
     assertions.assert_not_empty((0, ))
Beispiel #8
0
 def test_fails_on_empty_tuple(self):
     with assertions.assert_raises(AssertionError):
         assertions.assert_not_empty(())
Beispiel #9
0
 def test_passes_on_nonempty_list(self):
     """Test that assert_not_empty passes on a nonempty list."""
     assertions.assert_not_empty([0])
Beispiel #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([])
Beispiel #11
0
 def test_passes_on_nonempty_tuple(self):
     """Test that assert_not_empty passes on a nonempty tuple."""
     assertions.assert_not_empty((0,))
Beispiel #12
0
 def test_fails_on_empty_tuple(self):
     with assertions.assert_raises(AssertionError):
         assertions.assert_not_empty(())