Example #1
0
    def test_power_non_number(self):
        # Message changed in python3.6
        with pytest.raises(AnsibleFilterError, match='pow\\(\\) can only be used on numbers: (a float is required|must be real number, not str)'):
            ms.power('a', 10)

        with pytest.raises(AnsibleFilterError, match='pow\\(\\) can only be used on numbers: (a float is required|must be real number, not str)'):
            ms.power(10, 'a')
Example #2
0
    def test_power_non_number(self):
        with pytest.raises(
                AnsibleFilterError,
                message='pow() can only be used on numbers: a float is required'
        ):
            ms.power('a', 10)

        with pytest.raises(
                AnsibleFilterError,
                message='pow() can only be used on numbers: a float is required'
        ):
            ms.power(10, 'a')
Example #3
0
 def test_power_cubed(self):
     assert ms.power(10, 3) == 1000
Example #4
0
 def test_power_squared(self):
     assert ms.power(10, 2) == 100
Example #5
0
    def test_power_non_number(self):
        with pytest.raises(AnsibleFilterError, message='pow() can only be used on numbers: a float is required'):
            ms.power('a', 10)

        with pytest.raises(AnsibleFilterError, message='pow() can only be used on numbers: a float is required'):
            ms.power(10, 'a')
Example #6
0
 def test_power_cubed(self):
     assert ms.power(10, 3) == 1000
Example #7
0
 def test_power_squared(self):
     assert ms.power(10, 2) == 100