def test_many(self): for i in range(100): lbproc = _LBProc(i) with mock.patch('warnings.warn') as warn: flag = lbproc.flag2 self.assertEqual(warn.call_count, 1) self.assertEqual(flag, bool(i & 2))
def test_equal_int(self): self.assertTrue(_LBProc(17).__eq__(17))
def test_invalid_str(self): with self.assertRaisesRegexp(ValueError, 'invalid literal for int'): _LBProc('asdf')
def test_double_digit_slice(self): lbproc = _LBProc(1234) with mock.patch('warnings.warn') as warn: lbproc[1:3] = 65 self.assertEqual(warn.call_count, 4) self.assertEqual(lbproc, 1654)
def test_str(self): _LBProc('245')
def test_invalid(self): lbproc = _LBProc(1234) with mock.patch('warnings.warn') as warn: with self.assertRaises(ValueError): lbproc[1] = 81 self.assertEqual(warn.call_count, 1)
def test_out_of_bounds_scalar(self): lbproc = _LBProc(1234) with mock.patch('warnings.warn') as warn: lbproc[9] = 4 self.assertEqual(warn.call_count, 1) self.assertEqual(lbproc, 4000001234)
def test_not_equal_int(self): self.assertTrue(_LBProc(10).__ne__(15))
def test(self): lbproc = _LBProc(12) lbproc &= 8 self.assertEqual(int(lbproc), 8)
def test_equal_int(self): self.assertFalse(_LBProc(8).__ne__(8))
def test_not_equal(self): self.assertTrue(_LBProc(9).__ne__(_LBProc(14)))
def test_equal(self): self.assertFalse(_LBProc(7).__ne__(_LBProc(7)))
def test_not_equal_int(self): self.assertFalse(_LBProc(17).__eq__(16))
def test_not_equal(self): self.assertFalse(_LBProc(17).__eq__(_LBProc(18)))
def test_out_of_bounds_slice(self): lbproc = _LBProc(1234) with mock.patch('warnings.warn') as warn: digit = lbproc[10:] self.assertEqual(warn.call_count, 1) self.assertEqual(digit, 0)
def test(self): lbproc = _LBProc(12) lbproc |= 1 self.assertEqual(int(lbproc), 13)
def test_ok(self): lbproc = _LBProc(1234) with mock.patch('warnings.warn') as warn: lbproc[1] = 9 self.assertEqual(warn.call_count, 1) self.assertEqual(int(lbproc), 1294)
def test(self): lbproc = _LBProc(26) with mock.patch('warnings.warn') as warn: flags = lbproc.flags self.assertEqual(warn.call_count, 1) self.assertEqual(flags, (2, 8, 16))
def test_int(self): _LBProc(42)
def test(self): lbproc = _LBProc(8641) self.assertEqual(repr(lbproc), '_LBProc(8641)')
def test_single_digit_slice(self): lbproc = _LBProc(1234) with mock.patch('warnings.warn') as warn: lbproc[1:2] = 6 self.assertEqual(warn.call_count, 3) self.assertEqual(lbproc, 1264)
def test(self): lbproc = _LBProc(8641) self.assertEqual(str(lbproc), '8641')
def test_out_of_bounds_slice(self): lbproc = _LBProc(1234) with mock.patch('warnings.warn') as warn: lbproc[6:] = 49 self.assertEqual(warn.call_count, 4) self.assertEqual(lbproc, 49001234)
def test_positive(self): lbproc = _LBProc(24) with mock.patch('warnings.warn') as warn: length = len(lbproc) self.assertEqual(warn.call_count, 1) self.assertEqual(length, 2)
def test_negative(self): msg = 'Negative numbers not supported with splittable integers object' with self.assertRaisesRegexp(ValueError, msg): _LBProc(-1) with self.assertRaisesRegexp(ValueError, msg): _LBProc('-1')
def test_normal_scalar(self): lbproc = _LBProc(1234) with mock.patch('warnings.warn') as warn: digit = lbproc[1] self.assertEqual(warn.call_count, 1) self.assertEqual(digit, 3)
def test_false(self): lbproc = _LBProc(1) with mock.patch('warnings.warn') as warn: flag = lbproc.flag2 self.assertEqual(warn.call_count, 1) self.assertFalse(flag)
def test_double_digit_slice(self): lbproc = _LBProc(1234) with mock.patch('warnings.warn') as warn: digit = lbproc[1:3] self.assertEqual(warn.call_count, 1) self.assertEqual(digit, 23)
def test_true(self): lbproc = _LBProc(6) with mock.patch('warnings.warn') as warn: flag = lbproc.flag4 self.assertEqual(warn.call_count, 1) self.assertTrue(flag)
def test(self): self.assertEqual(int(_LBProc(99)), 99)