def test_check_comparison_edge_cases(): with pytest.raises(TypeError, match="required positional argument"): check_comparison(1, 1) with pytest.raises(TypeError, match="unexpected keyword"): check_comparison(item1=1, operator=gt, item_2=2) with pytest.raises(TypeError, match="unexpected keyword"): check_comparison(item_1=1, Operator=gt, item_2=2) with pytest.raises(TypeError, match="unexpected keyword"): check_comparison(item_1=1, operator=gt, item2=2)
def test_check_comparison_negative(): with pytest.raises(ValueError): check_comparison(3, eq, 2) with warnings.catch_warnings(record=True) as w: check_comparison(3, eq, 2, Warning, "This is a testing warning") assert "This is a testing warning" in str(w[-1].message) with pytest.raises(ValueError): check_comparison(2, ne, 2) with warnings.catch_warnings(record=True) as w: check_comparison(2, ne, 2, Warning, "This is a testing warning") assert "This is a testing warning" in str(w[-1].message) with pytest.raises(ValueError): check_comparison(2, lt, 2) with warnings.catch_warnings(record=True) as w: check_comparison(2, lt, 2, Warning, "This is a testing warning") assert "This is a testing warning" in str(w[-1].message) with pytest.raises(ValueError): check_comparison(2, gt, 2) with warnings.catch_warnings(record=True) as w: check_comparison(2, gt, 2, Warning, "This is a testing warning") assert "This is a testing warning" in str(w[-1].message) with pytest.raises(ValueError): check_comparison(3, lt, 2) with warnings.catch_warnings(record=True) as w: check_comparison(3, lt, 2, Warning, "This is a testing warning") assert "This is a testing warning" in str(w[-1].message) with pytest.raises(ValueError): check_comparison(3, le, 2) with warnings.catch_warnings(record=True) as w: check_comparison(3, le, 2, Warning, "This is a testing warning") assert "This is a testing warning" in str(w[-1].message) with pytest.raises(ValueError): check_comparison("one text", lt, "another text") with warnings.catch_warnings(record=True) as w: check_comparison( "one text", lt, "another text", Warning, "This is a testing warning", ) assert "This is a testing warning" in str(w[-1].message) with pytest.raises(ValueError): check_comparison("abc", is_, "xyz") with warnings.catch_warnings(record=True) as w: check_comparison("abc", is_, "xyz", Warning, "This is a testing warning") assert "This is a testing warning" in str(w[-1].message) with pytest.raises(ValueError): check_comparison("abc", is_not, "abc") with warnings.catch_warnings(record=True) as w: check_comparison("abc", is_not, "abc", Warning, "This is a testing warning") assert "This is a testing warning" in str(w[-1].message) with pytest.raises(ComparisonError): check_comparison("one text", lt, "another text", handle_with=ComparisonError)
def test_check_comparison_positive(): assert check_comparison(2, eq, 2) is None assert check_comparison(2, eq, 2, Warning) is None assert check_comparison(2, ne, 3) is None assert check_comparison(2, ne, 3, Warning) is None assert check_comparison(2, le, 2) is None assert check_comparison(2, le, 2, Warning) is None assert check_comparison(2, ge, 2) is None assert check_comparison(2, ge, 2, Warning) is None assert check_comparison(3, ge, 2) is None assert check_comparison(3, ge, 2, Warning) is None assert check_comparison(3, gt, 2) is None assert check_comparison(3, gt, 2, Warning) is None assert check_comparison("One text", lt, "one text") is None assert check_comparison("One text", lt, "one text", Warning) is None assert check_comparison("One text", lt, "another text") is None assert check_comparison("One text", lt, "another text", Warning) is None assert check_comparison("abc", is_, "abc") is None assert check_comparison("abc", is_, "abc", Warning) is None assert check_comparison("abc", is_not, "xyz") is None assert check_comparison("abc", is_not, "xyz", Warning) is None
def test_check_comparison_negative(): with pytest.raises(ValueError): check_comparison(3, eq, 2) with warnings.catch_warnings(record=True) as w: check_comparison(3, eq, 2, Warning, 'This is a testing warning') assert 'This is a testing warning' in str(w[-1].message) with pytest.raises(ValueError): check_comparison(2, ne, 2) with warnings.catch_warnings(record=True) as w: check_comparison(2, ne, 2, Warning, 'This is a testing warning') assert 'This is a testing warning' in str(w[-1].message) with pytest.raises(ValueError): check_comparison(2, lt, 2) with warnings.catch_warnings(record=True) as w: check_comparison(2, lt, 2, Warning, 'This is a testing warning') assert 'This is a testing warning' in str(w[-1].message) with pytest.raises(ValueError): check_comparison(2, gt, 2) with warnings.catch_warnings(record=True) as w: check_comparison(2, gt, 2, Warning, 'This is a testing warning') assert 'This is a testing warning' in str(w[-1].message) with pytest.raises(ValueError): check_comparison(3, lt, 2) with warnings.catch_warnings(record=True) as w: check_comparison(3, lt, 2, Warning, 'This is a testing warning') assert 'This is a testing warning' in str(w[-1].message) with pytest.raises(ValueError): check_comparison(3, le, 2) with warnings.catch_warnings(record=True) as w: check_comparison(3, le, 2, Warning, 'This is a testing warning') assert 'This is a testing warning' in str(w[-1].message) with pytest.raises(ValueError): check_comparison('one text', lt, 'another text') with warnings.catch_warnings(record=True) as w: check_comparison('one text', lt, 'another text', Warning, 'This is a testing warning') assert 'This is a testing warning' in str(w[-1].message) with pytest.raises(ValueError): check_comparison('abc', is_, 'xyz') with warnings.catch_warnings(record=True) as w: check_comparison('abc', is_, 'xyz', Warning, 'This is a testing warning') assert 'This is a testing warning' in str(w[-1].message) with pytest.raises(ValueError): check_comparison('abc', is_not, 'abc') with warnings.catch_warnings(record=True) as w: check_comparison('abc', is_not, 'abc', Warning, 'This is a testing warning') assert 'This is a testing warning' in str(w[-1].message) with pytest.raises(ComparisonError): check_comparison('one text', lt, 'another text', handle_with=ComparisonError)
def test_check_comparison_positive(): assert check_comparison(2, eq, 2) is None assert check_comparison(2, eq, 2, Warning) is None assert check_comparison(2, ne, 3) is None assert check_comparison(2, ne, 3, Warning) is None assert check_comparison(2, le, 2) is None assert check_comparison(2, le, 2, Warning) is None assert check_comparison(2, ge, 2) is None assert check_comparison(2, ge, 2, Warning) is None assert check_comparison(3, ge, 2) is None assert check_comparison(3, ge, 2, Warning) is None assert check_comparison(3, gt, 2) is None assert check_comparison(3, gt, 2, Warning) is None assert check_comparison('One text', lt, 'one text') is None assert check_comparison('One text', lt, 'one text', Warning) is None assert check_comparison('One text', lt, 'another text') is None assert check_comparison('One text', lt, 'another text', Warning) is None assert check_comparison('abc', is_, 'abc') is None assert check_comparison('abc', is_, 'abc', Warning) is None assert check_comparison('abc', is_not, 'xyz') is None assert check_comparison('abc', is_not, 'xyz', Warning) is None