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