def test_log_non_number(self): with pytest.raises( AnsibleFilterError, message='log() can only be used on numbers: a float is required' ): ms.logarithm('a') with pytest.raises( AnsibleFilterError, message='log() can only be used on numbers: a float is required' ): ms.logarithm(10, base='a')
def test_log_non_number(self): # Message changed in python3.6 with pytest.raises( AnsibleFilterTypeError, match= 'log\\(\\) can only be used on numbers: (a float is required|must be real number, not str)' ): ms.logarithm('a') with pytest.raises( AnsibleFilterTypeError, match= 'log\\(\\) can only be used on numbers: (a float is required|must be real number, not str)' ): ms.logarithm(10, base='a')
def test_log_two(self): assert ms.logarithm(69, 2) * 1000 // 1 == 6108
def test_log_natural(self): assert ms.logarithm(69) * 1000 // 1 == 4234
def test_log_ten(self): assert ms.logarithm(10, 10) == 1.0 assert ms.logarithm(69, 10) * 1000 // 1 == 1838
def test_log_two(self): assert ms.logarithm(69, 2) * 1000 // 1 == 6108
def test_log_natural(self): assert ms.logarithm(69) * 1000 // 1 == 4234
def test_log_ten(self): assert ms.logarithm(10, 10) == 1.0 assert ms.logarithm(69, 10) * 1000 // 1 == 1838
def test_log_non_number(self): with pytest.raises(AnsibleFilterError, message='log() can only be used on numbers: a float is required'): ms.logarithm('a') with pytest.raises(AnsibleFilterError, message='log() can only be used on numbers: a float is required'): ms.logarithm(10, base='a')