コード例 #1
0
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 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
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 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
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 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
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 def test_is_none_ok(self):
     soft = SoftAssert()
     soft.is_none(None)
     soft.assert_all()
コード例 #6
0
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 def test_equals_ok(self):
     soft = SoftAssert()
     soft.equals(1, 1)
     soft.assert_all()
コード例 #7
0
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 def test_raises_if_not_lambda(self):
     soft = SoftAssert()
     with self.assertRaises(TestBrokenException):
         soft.check(equals(1, 1))
コード例 #8
0
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 def test_not_raise_on_assert_all(self):
     soft = SoftAssert()
     soft.check(lambda: equals(1, 1))
     soft.assert_all()
コード例 #9
0
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 def test_is_negative_ok_int(self):
     soft = SoftAssert()
     soft.is_negative(-1)
     soft.assert_all()
コード例 #10
0
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 def test_do_nothing_if_empty_flag(self):
     soft = SoftAssert(check_immediately=True)
     soft.assert_all()
コード例 #11
0
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 def test_is_positive_failed_list(self):
     soft = SoftAssert()
     soft.is_positive([])
     with self.assertRaises(AssertionError):
         soft.assert_all()
コード例 #12
0
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 def test_is_positive_ok_list(self):
     soft = SoftAssert()
     soft.is_positive([1, 2])
     soft.assert_all()
コード例 #13
0
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 def test_is_positive_ok_float(self):
     soft = SoftAssert()
     soft.is_positive(3.14)
     soft.assert_all()
コード例 #14
0
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 def test_is_positive_ok_int(self):
     soft = SoftAssert()
     soft.is_positive(1)
     soft.assert_all()
コード例 #15
0
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 def test_do_nothing_if_empty(self):
     soft = SoftAssert()
     soft.assert_all()
コード例 #16
0
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 def test_raise_on_assert_all(self):
     with self.assertRaises(AssertionError):
         soft = SoftAssert()
         soft.check(lambda: equals(1, 2))
         soft.assert_all()
コード例 #17
0
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 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
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 def test_is_negative_ok_float(self):
     soft = SoftAssert()
     soft.is_negative(-3.14)
     soft.assert_all()
コード例 #19
0
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 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
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 def test_is_negative_failed_float(self):
     soft = SoftAssert()
     soft.is_negative(1.2)
     with self.assertRaises(AssertionError):
         soft.assert_all()
コード例 #21
0
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 def test_raises_if_not_lambda_flag(self):
     soft = SoftAssert(check_immediately=True)
     with self.assertRaises(TestBrokenException):
         soft.check(equals(1, 1))
コード例 #22
0
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 def test_is_not_empty_ok_list(self):
     soft = SoftAssert()
     soft.is_not_empty([1, 2])
     soft.assert_all()
コード例 #23
0
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 def test_not_fail_if_error_without_assert_all(self):
     soft = SoftAssert()
     soft.check(lambda: equals(1, 2))
コード例 #24
0
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 def test_is_not_empty_ok_dict(self):
     soft = SoftAssert()
     soft.is_not_empty({1: 1})
     soft.assert_all()
コード例 #25
0
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 def test_equals_failed(self):
     soft = SoftAssert()
     soft.equals(1, 2)
     with self.assertRaises(AssertionError):
         soft.assert_all()
コード例 #26
0
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 def test_is_not_empty_failed(self):
     soft = SoftAssert()
     soft.is_not_empty(set())
     with self.assertRaises(AssertionError):
         soft.assert_all()
コード例 #27
0
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 def test_is_none_failed(self):
     soft = SoftAssert()
     soft.is_none(1)
     with self.assertRaises(AssertionError):
         soft.assert_all()
コード例 #28
0
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 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
ファイル: soft_assert_test.py プロジェクト: kotolex/checking
 def test_is_false_ok(self):
     soft = SoftAssert()
     soft.is_false(0)
     soft.assert_all()