Пример #1
0
 def test_without_flag_do_calc_after(self):
     count_ = count
     soft = SoftAssert()
     soft.check(lambda: raise_count())
     self.assertEqual(count_, count)
     soft.assert_all()
     self.assertEqual(count_ + 1, count)
Пример #2
0
 def test_with_flag_do_calc_before(self):
     count_ = count
     soft = SoftAssert(check_immediately=True)
     soft.check(lambda: raise_count())
     self.assertEqual(count_ + 1, count)
     soft.assert_all()
     self.assertEqual(count_ + 1, count)
Пример #3
0
 def test_is_zero_ok(self):
     soft = SoftAssert()
     soft.is_zero(0)
     soft.assert_all()
Пример #4
0
def sa_ok():
    soft = SoftAssert()
    soft.check(lambda: equals(1, 1))
    soft.check(lambda: equals(2, 2))
    soft.assert_all()
Пример #5
0
 def test_is_none_ok(self):
     soft = SoftAssert()
     soft.is_none(None)
     soft.assert_all()
Пример #6
0
 def test_equals_ok(self):
     soft = SoftAssert()
     soft.equals(1, 1)
     soft.assert_all()
Пример #7
0
 def test_raises_if_not_lambda(self):
     soft = SoftAssert()
     with self.assertRaises(TestBrokenException):
         soft.check(equals(1, 1))
Пример #8
0
 def test_not_raise_on_assert_all(self):
     soft = SoftAssert()
     soft.check(lambda: equals(1, 1))
     soft.assert_all()
Пример #9
0
 def test_is_negative_ok_int(self):
     soft = SoftAssert()
     soft.is_negative(-1)
     soft.assert_all()
Пример #10
0
 def test_do_nothing_if_empty_flag(self):
     soft = SoftAssert(check_immediately=True)
     soft.assert_all()
Пример #11
0
 def test_is_positive_failed_list(self):
     soft = SoftAssert()
     soft.is_positive([])
     with self.assertRaises(AssertionError):
         soft.assert_all()
Пример #12
0
 def test_is_positive_ok_list(self):
     soft = SoftAssert()
     soft.is_positive([1, 2])
     soft.assert_all()
Пример #13
0
 def test_is_positive_ok_float(self):
     soft = SoftAssert()
     soft.is_positive(3.14)
     soft.assert_all()
Пример #14
0
 def test_is_positive_ok_int(self):
     soft = SoftAssert()
     soft.is_positive(1)
     soft.assert_all()
Пример #15
0
 def test_do_nothing_if_empty(self):
     soft = SoftAssert()
     soft.assert_all()
Пример #16
0
 def test_raise_on_assert_all(self):
     with self.assertRaises(AssertionError):
         soft = SoftAssert()
         soft.check(lambda: equals(1, 2))
         soft.assert_all()
Пример #17
0
 def test_raise_on_assert_all_flag(self):
     with self.assertRaises(AssertionError):
         soft = SoftAssert(check_immediately=True)
         soft.check(lambda: equals(1, 2))
         soft.assert_all()
Пример #18
0
 def test_is_negative_ok_float(self):
     soft = SoftAssert()
     soft.is_negative(-3.14)
     soft.assert_all()
Пример #19
0
 def test_not_raise_on_assert_all_flag(self):
     soft = SoftAssert(check_immediately=True)
     soft.check(lambda: equals(1, 1))
     soft.assert_all()
Пример #20
0
 def test_is_negative_failed_float(self):
     soft = SoftAssert()
     soft.is_negative(1.2)
     with self.assertRaises(AssertionError):
         soft.assert_all()
Пример #21
0
 def test_raises_if_not_lambda_flag(self):
     soft = SoftAssert(check_immediately=True)
     with self.assertRaises(TestBrokenException):
         soft.check(equals(1, 1))
Пример #22
0
 def test_is_not_empty_ok_list(self):
     soft = SoftAssert()
     soft.is_not_empty([1, 2])
     soft.assert_all()
Пример #23
0
 def test_not_fail_if_error_without_assert_all(self):
     soft = SoftAssert()
     soft.check(lambda: equals(1, 2))
Пример #24
0
 def test_is_not_empty_ok_dict(self):
     soft = SoftAssert()
     soft.is_not_empty({1: 1})
     soft.assert_all()
Пример #25
0
 def test_equals_failed(self):
     soft = SoftAssert()
     soft.equals(1, 2)
     with self.assertRaises(AssertionError):
         soft.assert_all()
Пример #26
0
 def test_is_not_empty_failed(self):
     soft = SoftAssert()
     soft.is_not_empty(set())
     with self.assertRaises(AssertionError):
         soft.assert_all()
Пример #27
0
 def test_is_none_failed(self):
     soft = SoftAssert()
     soft.is_none(1)
     with self.assertRaises(AssertionError):
         soft.assert_all()
Пример #28
0
 def test_not_fail_if_error_without_assert_all_flag(self):
     soft = SoftAssert(check_immediately=True)
     soft.check(lambda: equals(1, 2))
Пример #29
0
def sa_failed():
    soft = SoftAssert()
    soft.check(lambda: equals(1, 2))
    soft.check(lambda: equals(2, 2))
    soft.assert_all()
Пример #30
0
 def test_is_false_ok(self):
     soft = SoftAssert()
     soft.is_false(0)
     soft.assert_all()