fix tests and lints

This commit is contained in:
Brandon Thomas committed 2023-10-09 21:55:48 -04:00
1 parent c8b79bfb40
commit 1c81874b28
5 files changed
+9 -8

No files matched your search

@@ -98,7 +98,7 @@ mod tests {
fn all_variants() {
// Static check
let mut variants = IdCategory::all_variants();
assert_eq!(variants.len(), 3);
assert_eq!(variants.len(), 4);
assert_eq!(variants.pop_first(), Some(IdCategory::MediaFile));
assert_eq!(variants.pop_first(), Some(IdCategory::LipsyncAnimation));
assert_eq!(variants.pop_first(), Some(IdCategory::ZsDataset));
+1 -1
View File
@@ -1,4 +1,4 @@
use log::{info, log};
use log::info;
use sqlx::mysql::MySqlPoolOptions;
use config::shared_constants::{DEFAULT_MYSQL_CONNECTION_STRING, DEFAULT_RUST_LOG};
@@ -116,6 +116,7 @@ impl InferenceCategoryAbbreviated {
mod tests {
use crate::payloads::generic_inference_args::generic_inference_args::{FundamentalFrequencyMethodForJob, GenericInferenceArgs, InferenceCategoryAbbreviated, PolymorphicInferenceArgs};
use crate::payloads::generic_inference_args::lipsync_payload::{LipsyncAnimationAudioSource, LipsyncAnimationImageSource, LipsyncArgs};
use crate::payloads::generic_inference_args::tts_payload::TTSArgs;
#[test]
fn typical_lipsync_animation_args_serialize() {
@@ -148,14 +149,17 @@ mod tests {
#[test]
fn typical_tts_args_serialize() {
let args = GenericInferenceArgs {
inference_category: Some(InferenceCategoryAbbreviated::VoiceConversion),
args: Some(PolymorphicInferenceArgs::Tts()),
inference_category: Some(InferenceCategoryAbbreviated::TextToSpeech),
args: Some(PolymorphicInferenceArgs::Tts(TTSArgs {
text: "hello world".to_string(),
voice_token: "token".to_string(),
})),
};
let json = serde_json::ser::to_string(&args).unwrap();
// NB: Assert the serialized form. If this changes and the test breaks, be careful about migrating.
assert_eq!(json, r#"{"cat":"vc","args":{"Tts":{}}}"#.to_string());
assert_eq!(json, r#"{"cat":"tts","args":{"Tts":{"t":"hello world","e":"token"}}}"#.to_string());
// NB: Make sure we don't overflow the DB field capacity (TEXT column).
assert!(json.len() < 1000);
@@ -1,5 +1,4 @@
use anyhow::anyhow;
use chrono::{DateTime, Utc};
use log::error;
use sqlx::{MySql, MySqlPool};
use sqlx::pool::PoolConnection;
@@ -8,7 +7,6 @@ use enums::common::visibility::Visibility;
use errors::AnyhowResult;
use tokens::tokens::zs_voice::ZsVoiceToken;
pub struct ZsVoice {
pub token: ZsVoiceToken,
pub title: String,
@@ -4,7 +4,6 @@ use enums::by_table::generic_inference_jobs::inference_model_type::InferenceMode
use enums::by_table::tts_models::tts_model_type::TtsModelType;
use mysql_queries::queries::generic_inference::job::list_available_generic_inference_jobs::AvailableInferenceJob;
use mysql_queries::queries::tts::tts_models::get_tts_model_for_inference_improved::get_tts_model_for_inference_improved;
use tokens::tokens::tts_models::TtsModelToken;
use crate::job::job_loop::job_success_result::JobSuccessResult;
use crate::job::job_loop::process_single_job_error::ProcessSingleJobError;