Beispiel #1
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)
Beispiel #2
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)
Beispiel #3
0
 def test_not_contains_failed(self):
     soft = SoftAssert()
     soft.not_contains(2, [1, 2])
     with self.assertRaises(AssertionError):
         soft.assert_all()
Beispiel #4
0
def sa_ok():
    soft = SoftAssert()
    soft.check(lambda: equals(1, 1))
    soft.check(lambda: equals(2, 2))
    soft.assert_all()
Beispiel #5
0
 def test_is_none_ok(self):
     soft = SoftAssert()
     soft.is_none(None)
     soft.assert_all()
Beispiel #6
0
 def test_equals_ok(self):
     soft = SoftAssert()
     soft.equals(1, 1)
     soft.assert_all()
Beispiel #7
0
 def test_not_raise_on_assert_all(self):
     soft = SoftAssert()
     soft.check(lambda: equals(1, 1))
     soft.assert_all()
Beispiel #8
0
 def test_raise_on_assert_all(self):
     with self.assertRaises(AssertionError):
         soft = SoftAssert()
         soft.check(lambda: equals(1, 2))
         soft.assert_all()
Beispiel #9
0
 def test_is_positive_ok_float(self):
     soft = SoftAssert()
     soft.is_positive(3.14)
     soft.assert_all()
Beispiel #10
0
 def test_is_positive_ok_int(self):
     soft = SoftAssert()
     soft.is_positive(1)
     soft.assert_all()
Beispiel #11
0
 def test_do_nothing_if_empty(self):
     soft = SoftAssert()
     soft.assert_all()
Beispiel #12
0
 def test_is_zero_ok(self):
     soft = SoftAssert()
     soft.is_zero(0)
     soft.assert_all()
Beispiel #13
0
 def test_is_false_ok(self):
     soft = SoftAssert()
     soft.is_false(0)
     soft.assert_all()
Beispiel #14
0
 def test_is_true_ok(self):
     soft = SoftAssert()
     soft.is_true(1)
     soft.assert_all()
Beispiel #15
0
 def test_is_not_empty_ok_dict(self):
     soft = SoftAssert()
     soft.is_not_empty({1: 1})
     soft.assert_all()
Beispiel #16
0
 def test_is_not_empty_failed(self):
     soft = SoftAssert()
     soft.is_not_empty(set())
     with self.assertRaises(AssertionError):
         soft.assert_all()
Beispiel #17
0
 def test_is_positive_ok_list(self):
     soft = SoftAssert()
     soft.is_positive([1, 2])
     soft.assert_all()
Beispiel #18
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()
Beispiel #19
0
 def test_is_positive_failed_list(self):
     soft = SoftAssert()
     soft.is_positive([])
     with self.assertRaises(AssertionError):
         soft.assert_all()
Beispiel #20
0
 def test_not_raise_on_assert_all_flag(self):
     soft = SoftAssert(check_immediately=True)
     soft.check(lambda: equals(1, 1))
     soft.assert_all()
Beispiel #21
0
 def test_do_nothing_if_empty_flag(self):
     soft = SoftAssert(check_immediately=True)
     soft.assert_all()
Beispiel #22
0
 def test_is_negative_ok_int(self):
     soft = SoftAssert()
     soft.is_negative(-1)
     soft.assert_all()
Beispiel #23
0
 def test_is_negative_ok_float(self):
     soft = SoftAssert()
     soft.is_negative(-3.14)
     soft.assert_all()
Beispiel #24
0
 def test_equals_failed(self):
     soft = SoftAssert()
     soft.equals(1, 2)
     with self.assertRaises(AssertionError):
         soft.assert_all()
Beispiel #25
0
 def test_is_negative_failed_float(self):
     soft = SoftAssert()
     soft.is_negative(1.2)
     with self.assertRaises(AssertionError):
         soft.assert_all()
Beispiel #26
0
 def test_is_none_failed(self):
     soft = SoftAssert()
     soft.is_none(1)
     with self.assertRaises(AssertionError):
         soft.assert_all()
Beispiel #27
0
 def test_is_not_empty_ok_list(self):
     soft = SoftAssert()
     soft.is_not_empty([1, 2])
     soft.assert_all()
Beispiel #28
0
def sa_failed():
    soft = SoftAssert()
    soft.check(lambda: equals(1, 2))
    soft.check(lambda: equals(2, 2))
    soft.assert_all()
Beispiel #29
0
 def test_not_contains_ok(self):
     soft = SoftAssert()
     soft.not_contains(3, [1, 2])
     soft.assert_all()