Skip to content

Commit

Permalink
Improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Babic committed Dec 22, 2024
1 parent 7b42654 commit 560a3a5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ jobs:
run: |
tox --installpkg ./dist/*.whl || (echo "::error::Tests failed" && exit 1)
- name: ⬆️ Upload coverage data
uses: actions/upload-artifact@v4
with:
name: coverage-data-${{ matrix.python-version }}-${{ matrix.django }}-${{ matrix.wagtail }}-${{ matrix.db }}
path: .coverage*
if-no-files-found: error
include-hidden-files: true

test-sqlite:
runs-on: ubuntu-latest
strategy:
Expand Down
15 changes: 15 additions & 0 deletions tests/test_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,18 @@ def test_get_prep_value_with_none(self):
# Should return None
result = self.field.get_prep_value(None)
self.assertIsNone(result)

def test_deconstruct_removes_block_lookup(self):
# Test that block_lookup is removed during deconstruction
field = StreamField(self.block_types)
field.block_lookup = {"some": "value"} # Add block_lookup
name, path, args, kwargs = field.deconstruct()
self.assertNotIn("block_lookup", kwargs)

def test_to_python_with_raw_text_and_child_blocks(self):
# Test that raw_text is properly handled when child_blocks exist
field = StreamField(self.block_types) # Field with child blocks
value = "some raw text"
result = field.to_python(value)
self.assertIsInstance(result, StreamValue)
self.assertEqual(len(result), 0) # Should be empty as text isn't valid JSON

0 comments on commit 560a3a5

Please sign in to comment.