def test_random_pyfloat(self): from faker.providers.python import Provider provider = Provider(self.generator) assert 0 <= abs(provider.pyfloat(left_digits=1)) < 10 assert 0 <= abs(provider.pyfloat(left_digits=0)) < 1 x = abs(provider.pyfloat(right_digits=0)) assert x - int(x) == 0 with pytest.raises(ValueError): provider.pyfloat(left_digits=0, right_digits=0)
def test_random_pyfloat(self): from faker.providers.python import Provider provider = Provider(self.generator) assert 0 <= abs(provider.pyfloat(left_digits=1)) < 10 assert 0 <= abs(provider.pyfloat(left_digits=0)) < 1 x = abs(provider.pyfloat(right_digits=0)) assert x - int(x) == 0 with pytest.raises(ValueError): provider.pyfloat(left_digits=0, right_digits=0)
def test_random_pyfloat(self): from faker.providers.python import Provider provider = Provider(self.generator) self.assertTrue(0 <= abs(provider.pyfloat(left_digits=1)) < 10) self.assertTrue(0 <= abs(provider.pyfloat(left_digits=0)) < 1) x = abs(provider.pyfloat(right_digits=0)) self.assertTrue(x - int(x) == 0) with self.assertRaises(ValueError, msg='A float number cannot have 0 digits ' 'in total'): provider.pyfloat(left_digits=0, right_digits=0)
def test_random_pyfloat(self): from faker.providers.python import Provider provider = Provider(self.generator) self.assertTrue(0 <= abs(provider.pyfloat(left_digits=1)) < 10) self.assertTrue(0 <= abs(provider.pyfloat(left_digits=0)) < 1) x = abs(provider.pyfloat(right_digits=0)) self.assertTrue(x - int(x) == 0) with self.assertRaises(ValueError, msg='A float number cannot have 0 digits ' 'in total'): provider.pyfloat(left_digits=0, right_digits=0)