PG1204 opened a new pull request, #6438:
URL: https://github.com/apache/texera/pull/6438
### What changes were proposed in this PR?
Adds dedicated unit test coverage for MediaGenCodegen, the TaskCodegen
object that generates the Python payload/parse snippets for Hugging Face
media-generation operators (text-to-image and text-to-video). This class
previously had no direct test coverage.
A new spec file, [MediaGenCodegenSpec.scala was created in the same test
package, mirroring the structure and patterns of TextGenCodegenSpec (shared
makeCtx helper; assertions on snippet structure/markers rather than exact
whitespace). It adds 9 tests covering:
- task equals "text-to-image"
- tasks equals exactly Set("text-to-image", "text-to-video")
- payloadPython emits the static {"inputs": prompt_value} payload
- parsePython branches on both media tasks, routes URL responses through the
shared _url_to_data_url helper, converts OpenAI b64_json payloads into a
data:image/png;base64, URL, and falls back to json.dumps(body)
- Snippets never inline raw CodegenContext string values (no sentinel
leakage)
- Context-independence: identical output across two unrelated CodegenContext
instances
### Any related issues, documentation, discussions?
Closes #6252
### How was this PR tested?
Added 9 unit tests in the new spec file, all passing via sbt:
sbt "WorkflowOperator/testOnly
org.apache.texera.amber.operator.huggingFace.codegen.MediaGenCodegenSpec"
[info] Tests: succeeded 9, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
### Was this PR authored or co-authored using generative AI tooling?
Co-authored with Claude Opus 4.8 in compliance with ASF
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]