예제 #1
0
 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')
예제 #2
0
 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')
예제 #3
0
 def test_log_two(self):
     assert ms.logarithm(69, 2) * 1000 // 1 == 6108
예제 #4
0
 def test_log_natural(self):
     assert ms.logarithm(69) * 1000 // 1 == 4234
예제 #5
0
 def test_log_ten(self):
     assert ms.logarithm(10, 10) == 1.0
     assert ms.logarithm(69, 10) * 1000 // 1 == 1838
예제 #6
0
 def test_log_two(self):
     assert ms.logarithm(69, 2) * 1000 // 1 == 6108
예제 #7
0
 def test_log_natural(self):
     assert ms.logarithm(69) * 1000 // 1 == 4234
예제 #8
0
 def test_log_ten(self):
     assert ms.logarithm(10, 10) == 1.0
     assert ms.logarithm(69, 10) * 1000 // 1 == 1838
예제 #9
0
 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')