示例#1
0
 def test_sqrt(self):
     self.assertEqual(calc.sqrt(2), 4)
示例#2
0
import calc

a=input("Enter the a value:")
b=input("Enter the b value:")
print "Sum of the a and b is:",calc.add(a,b)
print "Difference of the a and b is:",calc.diff(a,b)
print "Multiplication of the a and b is:",calc.mul(a,b)
print "Divison of the a and b is:",calc.div(a,b)
print "Square root of the a is:",calc.sqrt(a)
print "Square root of the b is:",calc.sqrt(b)
print "floordiv of the a and b is:",calc.floordiv(a,b)
print "modulus of the a and b is:",calc.mod(a,b)
print "Prime number verification for a:",calc.prime(a)
print "Prime number verification for b:",calc.prime(b)
示例#3
0
 def test_sqrt ( self ):
     self.assertEqual(calc.sqrt( 4 ), 2 )
示例#4
0
文件: unittest.py 项目: j1nn33/study
class CalcExTests ( unittest.TestCase ):
    def test_sqrt ( self ):
        self.assertEqual(calc.sqrt( 4 ), 2 )
示例#5
0
 def test_sqrt(self):
     """Тест на извлечение корня """
     print("id: " + self.id())
     self.assertEqual(calc.sqrt(4), 2)
示例#6
0
def test_sqrt_wrong_type():
    with pytest.raises(TypeError):
        sqrt("4")
示例#7
0
def test_sqrt_negative_value():
    with pytest.raises(ValueError):
        sqrt(-1)
示例#8
0
def test_sqrt_correct_value():
    assert sqrt(4) == 2