feat: enhance file module with improved documentation and tests#92
feat: enhance file module with improved documentation and tests#92devin-ai-integration[bot] wants to merge 44 commits intomainfrom
Conversation
- Add type validation for template body fields - Implement binary record support with length validation - Add port number validation (1-100) - Support compact format with metadata field validation - Update API documentation with new features - Add comprehensive test suite Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
…ement Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
…thesis Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
- Add file parameter to file.stats method - Update docstrings with accurate return type information - Add comprehensive test coverage for file module methods - Split tests into separate files for better organization Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
⚙️ Control Options:
|
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
docs/api.md
Outdated
| * `file` The name of the file. | ||
| * `body` A JSON object to add to the note. | ||
| * `payload` An optional base64-encoded string. | ||
| * `binary` Binary data (bytearray) to be stored in the note. |
There was a problem hiding this comment.
binary is a boolean value, not a byte array. please see these docs: https://dev.blues.io/api-reference/notecard-api/note-requests/latest/#note-add
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
notecard/file.py
Outdated
| response = card.Transaction(req) | ||
| if "err" in response: | ||
| return response | ||
| # Check for required fields first |
There was a problem hiding this comment.
checking for "required" fields in the response is not a valid test. this is because notecard uses omitempty by default, meaning if there is a 0, false, or empty string "", that value would be omitted from the response.
notecard/file.py
Outdated
| response = card.Transaction(req) | ||
| if "err" in response: | ||
| return response | ||
| # Check for required fields |
There was a problem hiding this comment.
checking for "required" fields in the response is not a valid test. this is because notecard uses omitempty by default, meaning if there is a 0, false, or empty string "", that value would be omitted from the response.
notecard/file.py
Outdated
| response = card.Transaction(req) | ||
| if "err" in response: | ||
| return response | ||
| # Validate response format - should contain total and changes |
There was a problem hiding this comment.
checking for "required" fields in the response is not a valid test. this is because notecard uses omitempty by default, meaning if there is a 0, false, or empty string "", that value would be omitted from the response.
notecard/note.py
Outdated
| return {"err": "verify parameter must be a boolean"} | ||
|
|
||
| if length is not None: | ||
| if not isinstance(length, int) or length < 0: |
There was a problem hiding this comment.
length can be a negative number (it effectively resets the value to its default)
notecard/note.py
Outdated
| if format == "compact": | ||
| req["format"] = "compact" | ||
| if body: | ||
| allowed_metadata = {"_time", "_lat", "_lon", "_loc"} |
There was a problem hiding this comment.
_loc is not a valid value here, it should be replaced with _ltime
test/fluent_api/test_file_changes.py
Outdated
| } | ||
| response = file.changes(card) | ||
| # First validate the response has all required fields | ||
| assert 'changes' in response |
There was a problem hiding this comment.
these assert statements are invalid since notecard uses omitempty and those values may not exist on the response
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
…lity Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
|
Devin is currently unreachable - the session may have died. |
Co-Authored-By: rlauer@blues.com <rlauer@blues.com>
|
Closing due to inactivity. |
File Module Improvements
This PR enhances the file module with improved documentation and test coverage to better align with the official Notecard API documentation.
Changes
Testing
Documentation
Updated docstrings to accurately reflect:
Link to Devin run: https://app.devin.ai/sessions/95ffd763d71b445198b9370e49dcd93f