Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /ashita-ai_tessera /tests /test_proposal_validation.py
| """Tests for proposal model validation.""" | |
| import pytest | |
| from pydantic import ValidationError | |
| from tessera.models.proposal import ObjectionCreate | |
| def test_objection_create_reason_validation(): | |
| """Test validation for ObjectionCreate.reason field.""" | |
| # Test valid reason | |
| obj = ObjectionCreate(reason="Valid Reason") | |
| assert obj.reason == "Valid Reason" | |
| # Test whitespace stripping | |
| obj = ObjectionCreate(reason=" Valid Reason ") | |
| assert obj.reason == "Valid Reason" | |
| # Test empty string (should fail) | |
| with pytest.raises(ValidationError) as exc: | |
| ObjectionCreate(reason="") | |
| assert "String should have at least 1 character" in str(exc.value) | |
| # Test whitespace only string (should fail due to validator) | |
| with pytest.raises(ValidationError) as exc: | |
| ObjectionCreate(reason=" ") | |
| assert "Reason cannot be empty or whitespace only" in str(exc.value) | |
| # Test None (should fail) | |
| with pytest.raises(ValidationError): | |
| ObjectionCreate(reason=None) | |
Xet Storage Details
- Size:
- 1.02 kB
- Xet hash:
- 522314900087ac7bd560a41b1bfcd2abcebdfdcbc94ea60e56f0e71f8d99a266
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.