# PyWasot Tests

Unit tests for the PyWasot Python library.

## Running Tests

### Quick Start
```bash
# Install test dependencies
pip install pytest pytest-cov

# Run all tests
pytest

# Run with verbose output
pytest -v

# Run specific test file
pytest tests/test_text.py

# Run specific test class
pytest tests/test_block.py::TestBlockConstruction

# Run specific test
pytest tests/test_text.py::TestTextConstruction::test_varargs_multiple_lines
```

### Using Make
```bash
# Run tests
make test

# Run with verbose output
make test-verbose

# Run with coverage
make test-coverage

# Run basic functionality test
make test-basic
```

## Test Structure

- `test_text.py` - Tests for the Text class (varargs, content handling)
- `test_block.py` - Tests for the Block class (dict/list interface, nesting)
- `test_document.py` - Tests for the Document class (root container)
- `test_parsing.py` - Tests for parsing and round-trip conversion

## Test Coverage

To generate a coverage report:
```bash
pytest --cov=pywasot --cov-report=html
open htmlcov/index.html
```

## Writing New Tests

Follow the existing pattern:
```python
class TestFeatureName:
    """Test description."""
    
    def test_specific_behavior(self):
        """Test what this specific behavior does."""
        # Arrange
        obj = SomeClass()
        
        # Act
        result = obj.some_method()
        
        # Assert
        assert result == expected_value
```

## Known Issues

Some tests may fail due to implementation differences between the Rust parser and Python expectations. The core functionality (creating AST elements, converting to/from Wasot) works correctly as demonstrated by `test_basic.py`.