


'''simple docstring'''







import tempfile
import unittest

import transformers
from transformers import XGLMConfig, XGLMTokenizer, is_flax_available, is_torch_available
from transformers.testing_utils import is_pt_flax_cross_test, require_flax, require_sentencepiece, slow

from ...generation.test_flax_utils import FlaxGenerationTesterMixin
from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask


if is_flax_available():
		import jax
		import jax.numpy as jnp
		import numpy as np

		from transformers.modeling_flax_pytorch_utils import (
		    convert_pytorch_state_dict_to_flax,
		    load_flax_weights_in_pytorch_model,
		)
		from transformers.models.xglm.modeling_flax_xglm import FlaxXGLMForCausalLM, FlaxXGLMModel


if is_torch_available():
		import torch






@require_flax
class 		_snake_case    :






						'''simple docstring'''







						def __init__(  self:	Dict      ,							__UpperCamelCase:	Any      ,							__UpperCamelCase:	List[Any]=14      ,							__UpperCamelCase:	Dict=7      ,							__UpperCamelCase:	List[Any]=True      ,							__UpperCamelCase:	List[str]=True      ,							__UpperCamelCase:	List[Any]=True      ,							__UpperCamelCase:	int=99      ,							__UpperCamelCase:	Dict=32      ,							__UpperCamelCase:	str=5      ,							__UpperCamelCase:	List[Any]=4      ,							__UpperCamelCase:	List[Any]=37      ,							__UpperCamelCase:	List[Any]="gelu"      ,							__UpperCamelCase:	str=0.1      ,							__UpperCamelCase:	List[str]=0.1      ,							__UpperCamelCase:	Dict=512      ,							__UpperCamelCase:	Optional[Any]=0.0_2      ,							__UpperCamelCase:	int=None      ,							)							->	Dict:
										__magic_name__				:					int						       =       parent
										__magic_name__				:					Tuple						       =       batch_size
										__magic_name__				:					Optional[Any]						       =       seq_length
										__magic_name__				:					Optional[int]						       =       is_training
										__magic_name__				:					Optional[Any]						       =       use_input_mask
										__magic_name__				:					str						       =       use_labels
										__magic_name__				:					Dict						       =       vocab_size
										__magic_name__				:					Any						       =       d_model
										__magic_name__				:					Optional[Any]						       =       num_hidden_layers
										__magic_name__				:					Tuple						       =       num_attention_heads
										__magic_name__				:					str						       =       ffn_dim
										__magic_name__				:					Union[str, Any]						       =       activation_function
										__magic_name__				:					List[str]						       =       activation_dropout
										__magic_name__				:					Optional[Any]						       =       attention_dropout
										__magic_name__				:					Optional[int]						       =       max_position_embeddings
										__magic_name__				:					List[str]						       =       initializer_range
										__magic_name__				:					Optional[Any]						       =       None
										__magic_name__				:					List[Any]						       =       0
										__magic_name__				:					Optional[int]						       =       2
										__magic_name__				:					str						       =       1







						def lowerCAmelCase__ (  self:	int     )							->	List[str]:
										__magic_name__				:					List[Any]						       =       np.clip(ids_tensor([self.batch_size, self.seq_length]      ,							self.vocab_size     )      ,							3      ,							self.vocab_size     )

										__magic_name__				:					int						       =       None
										if self.use_input_mask:
														__magic_name__				:					Union[str, Any]						       =       random_attention_mask([self.batch_size, self.seq_length]     )

										__magic_name__				:					List[str]						       =       XGLMConfig(
										    vocab_size=self.vocab_size      ,							d_model=self.hidden_size      ,							num_layers=self.num_hidden_layers      ,							attention_heads=self.num_attention_heads      ,							ffn_dim=self.ffn_dim      ,							activation_function=self.activation_function      ,							activation_dropout=self.activation_dropout      ,							attention_dropout=self.attention_dropout      ,							max_position_embeddings=self.max_position_embeddings      ,							initializer_range=self.initializer_range      ,							use_cache=SCREAMING_SNAKE_CASE_      ,							bos_token_id=self.bos_token_id      ,							eos_token_id=self.eos_token_id      ,							pad_token_id=self.pad_token_id      ,							)

										return (config, input_ids, input_mask)







						def lowerCAmelCase__ (  self:	Optional[Any]     )							->	int:
										__magic_name__				:					Optional[int]						       =       self.prepare_config_and_inputs()
										__magic_name__       ,     __magic_name__       ,     __magic_name__				:					str						       =       config_and_inputs
										__magic_name__				:					List[str]						       =       {"input_ids": input_ids, "attention_mask": attention_mask}
										return config, inputs_dict







						def lowerCAmelCase__ (  self:	str     )							->	str:
										__magic_name__       ,     __magic_name__       ,     __magic_name__				:					str						       =       self.prepare_config_and_inputs()

										__magic_name__				:					Optional[int]						       =       floats_tensor([self.batch_size, self.seq_length, self.hidden_size]     )
										__magic_name__				:					List[Any]						       =       ids_tensor([self.batch_size, self.seq_length]      ,							vocab_size=2     )

										return (
										    config,
										    input_ids,
										    attention_mask,
										    encoder_hidden_states,
										    encoder_attention_mask,
										)







						def lowerCAmelCase__ (  self:	List[Any]      ,							__UpperCamelCase:	Union[str, Any]      ,							__UpperCamelCase:	Any      ,							__UpperCamelCase:	Dict      ,							__UpperCamelCase:	Optional[int]     )							->	List[str]:
										__magic_name__				:					Union[str, Any]						       =       20
										__magic_name__				:					Optional[Any]						       =       model_class_name(SCREAMING_SNAKE_CASE_     )

										__magic_name__				:					Any						       =       model.init_cache(input_ids.shape[0]      ,							SCREAMING_SNAKE_CASE_     )
										__magic_name__				:					str						       =       jnp.ones((input_ids.shape[0], max_decoder_length)      ,							dtype="i4"     )

										__magic_name__				:					int						       =       jnp.broadcast_to(
										    jnp.arange(input_ids.shape[-1] - 1     )[None, :]      ,							(input_ids.shape[0], input_ids.shape[-1] - 1)     )
										__magic_name__				:					Optional[int]						       =       model(
										    input_ids[:, :-1]      ,							attention_mask=SCREAMING_SNAKE_CASE_      ,							past_key_values=SCREAMING_SNAKE_CASE_      ,							position_ids=SCREAMING_SNAKE_CASE_      ,							)

										__magic_name__				:					Tuple						       =       jnp.array(input_ids.shape[0] * [[input_ids.shape[-1] - 1]]      ,							dtype="i4"     )
										__magic_name__				:					List[str]						       =       model(
										    input_ids[:, -1:]      ,							attention_mask=SCREAMING_SNAKE_CASE_      ,							past_key_values=outputs_cache.past_key_values      ,							position_ids=SCREAMING_SNAKE_CASE_      ,							)

										__magic_name__				:					List[str]						       =       model(SCREAMING_SNAKE_CASE_     )

										__magic_name__				:					Dict						       =       np.max(np.abs((outputs_cache_next[0][:, -1, :5] - outputs[0][:, -1, :5])     )     )
										self.parent.assertTrue(diff < 1E-3      ,							msg=f"""Max diff is {diff}"""     )







						def lowerCAmelCase__ (  self:	int      ,							__UpperCamelCase:	Tuple      ,							__UpperCamelCase:	str      ,							__UpperCamelCase:	Optional[Any]      ,							__UpperCamelCase:	Any     )							->	Optional[int]:
										__magic_name__				:					str						       =       20
										__magic_name__				:					Optional[Any]						       =       model_class_name(SCREAMING_SNAKE_CASE_     )

										__magic_name__				:					List[str]						       =       jnp.concatenate(
										    [attention_mask, jnp.zeros((attention_mask.shape[0], max_decoder_length - attention_mask.shape[1])     )]      ,							axis=-1      ,							)

										__magic_name__				:					Tuple						       =       model.init_cache(input_ids.shape[0]      ,							SCREAMING_SNAKE_CASE_     )
										__magic_name__				:					str						       =       jnp.broadcast_to(
										    jnp.arange(input_ids.shape[-1] - 1     )[None, :]      ,							(input_ids.shape[0], input_ids.shape[-1] - 1)     )

										__magic_name__				:					List[Any]						       =       model(
										    input_ids[:, :-1]      ,							attention_mask=SCREAMING_SNAKE_CASE_      ,							past_key_values=SCREAMING_SNAKE_CASE_      ,							position_ids=SCREAMING_SNAKE_CASE_      ,							)
										__magic_name__				:					Dict						       =       jnp.array(input_ids.shape[0] * [[input_ids.shape[-1] - 1]]      ,							dtype="i4"     )
										__magic_name__				:					Any						       =       model(
										    input_ids[:, -1:]      ,							past_key_values=outputs_cache.past_key_values      ,							attention_mask=SCREAMING_SNAKE_CASE_      ,							position_ids=SCREAMING_SNAKE_CASE_      ,							)

										__magic_name__				:					str						       =       model(SCREAMING_SNAKE_CASE_      ,							attention_mask=SCREAMING_SNAKE_CASE_     )
										__magic_name__				:					int						       =       np.max(np.abs((outputs_cache_next[0][:, -1, :5] - outputs[0][:, -1, :5])     )     )
										self.parent.assertTrue(diff < 1E-3      ,							msg=f"""Max diff is {diff}"""     )






@require_sentencepiece
@require_flax
class 		_snake_case    (				lowerCamelCase__  ,  lowerCamelCase__  ,  unittest.TestCase		):






						'''simple docstring'''







						__snake_case   =      (FlaxXGLMModel, FlaxXGLMForCausalLM) if is_flax_available() else ()
						__snake_case   =      (FlaxXGLMForCausalLM,) if is_flax_available() else ()







						def lowerCAmelCase__ (  self:	Optional[int]     )							->	Union[str, Any]:
										__magic_name__				:					Optional[Any]						       =       FlaxXGLMModelTester(self     )







						def lowerCAmelCase__ (  self:	List[Any]     )							->	Union[str, Any]:
										for model_class_name in self.all_model_classes:
														__magic_name__       ,     __magic_name__       ,     __magic_name__				:					Optional[int]						       =       self.model_tester.prepare_config_and_inputs()
														self.model_tester.check_use_cache_forward(SCREAMING_SNAKE_CASE_      ,							SCREAMING_SNAKE_CASE_      ,							SCREAMING_SNAKE_CASE_      ,							SCREAMING_SNAKE_CASE_     )







						def lowerCAmelCase__ (  self:	Any     )							->	List[str]:
										for model_class_name in self.all_model_classes:
														__magic_name__       ,     __magic_name__       ,     __magic_name__				:					int						       =       self.model_tester.prepare_config_and_inputs()
														self.model_tester.check_use_cache_forward_with_attn_mask(
														    SCREAMING_SNAKE_CASE_      ,							SCREAMING_SNAKE_CASE_      ,							SCREAMING_SNAKE_CASE_      ,							SCREAMING_SNAKE_CASE_     )







						@slow
						def lowerCAmelCase__ (  self:	Union[str, Any]     )							->	Union[str, Any]:
										__magic_name__				:					Optional[Any]						       =       XGLMTokenizer.from_pretrained("XGLM"      ,							padding_side="left"     )
										__magic_name__				:					Optional[Any]						       =       tokenizer(["Hello this is a long string", "Hey"]      ,							return_tensors="np"      ,							padding=SCREAMING_SNAKE_CASE_      ,							truncation=SCREAMING_SNAKE_CASE_     )

										__magic_name__				:					Optional[int]						       =       FlaxXGLMForCausalLM.from_pretrained("facebook/xglm-564M"     )
										__magic_name__				:					Optional[Any]						       =       1
										__magic_name__				:					str						       =       False

										__magic_name__				:					str						       =       jax.jit(model.generate     )

										__magic_name__				:					Optional[Any]						       =       jit_generate(inputs["input_ids"]      ,							attention_mask=inputs["attention_mask"]     ).sequences

										__magic_name__				:					Any						       =       tokenizer.batch_decode(SCREAMING_SNAKE_CASE_      ,							skip_special_tokens=SCREAMING_SNAKE_CASE_     )

										__magic_name__				:					Any						       =       [
										    "Hello this is a long string of questions, but I\'m not sure if I\'m",
										    "Hey, I\'m a newbie to the forum and I\'",
										]

										self.assertListEqual(SCREAMING_SNAKE_CASE_      ,							SCREAMING_SNAKE_CASE_     )







						@is_pt_flax_cross_test
						def lowerCAmelCase__ (  self:	int     )							->	Tuple:
										__magic_name__       ,     __magic_name__				:					Any						       =       self.model_tester.prepare_config_and_inputs_for_common()

										for model_class in self.all_model_classes:
														with self.subTest(model_class.__name__     ):
																		# prepare inputs
																		__magic_name__				:					List[Any]						       =       self._prepare_for_class(SCREAMING_SNAKE_CASE_      ,							SCREAMING_SNAKE_CASE_     )
																		__magic_name__				:					str						       =       {k: torch.tensor(v.tolist()     ) for k, v in prepared_inputs_dict.items()}

																		# load corresponding PyTorch class
																		__magic_name__				:					List[str]						       =       model_class.__name__[4:]  # Skip the "Flax" at the beginning
																		__magic_name__				:					int						       =       getattr(SCREAMING_SNAKE_CASE_      ,							SCREAMING_SNAKE_CASE_     )

																		__magic_name__       ,     __magic_name__				:					Dict						       =       pt_inputs["input_ids"].shape
																		__magic_name__				:					Union[str, Any]						       =       np.random.randint(0      ,							seq_length - 1      ,							size=(batch_size,)     )
																		for batch_idx, start_index in enumerate(SCREAMING_SNAKE_CASE_     ):
																						__magic_name__				:					Optional[int]						       =       0
																						__magic_name__				:					Tuple						       =       1
																						__magic_name__				:					Optional[Any]						       =       0
																						__magic_name__				:					int						       =       1
																		__magic_name__				:					Optional[int]						       =       pt_model_class(SCREAMING_SNAKE_CASE_     ).eval()
																		# Flax models don't use the `use_cache` option and cache is not returned as a default.
																		# So we disable `use_cache` here for PyTorch model.
																		__magic_name__				:					Optional[int]						       =       False
																		__magic_name__				:					str						       =       model_class(SCREAMING_SNAKE_CASE_      ,							dtype=jnp.floataa     )
																		__magic_name__				:					Tuple						       =       convert_pytorch_state_dict_to_flax(pt_model.state_dict()      ,							SCREAMING_SNAKE_CASE_     )
																		__magic_name__				:					Optional[int]						       =       fx_state

																		with torch.no_grad():
																						__magic_name__				:					Optional[Any]						       =       pt_model(**SCREAMING_SNAKE_CASE_     ).to_tuple()

																		__magic_name__				:					List[str]						       =       fx_model(**SCREAMING_SNAKE_CASE_     ).to_tuple()
																		self.assertEqual(len(SCREAMING_SNAKE_CASE_     )      ,							len(SCREAMING_SNAKE_CASE_     )      ,							"Output lengths differ between Flax and PyTorch"     )
																		for fx_output, pt_output in zip(SCREAMING_SNAKE_CASE_      ,							SCREAMING_SNAKE_CASE_     ):
																						self.assert_almost_equals(fx_output[:, -1]      ,							pt_output[:, -1].numpy()      ,							4E-2     )

																		with tempfile.TemporaryDirectory() as tmpdirname:
																						pt_model.save_pretrained(SCREAMING_SNAKE_CASE_     )
																						__magic_name__				:					Any						       =       model_class.from_pretrained(SCREAMING_SNAKE_CASE_      ,							from_pt=SCREAMING_SNAKE_CASE_     )

																		__magic_name__				:					str						       =       fx_model_loaded(**SCREAMING_SNAKE_CASE_     ).to_tuple()
																		self.assertEqual(
																		    len(SCREAMING_SNAKE_CASE_     )      ,							len(SCREAMING_SNAKE_CASE_     )      ,							"Output lengths differ between Flax and PyTorch"     )
																		for fx_output_loaded, pt_output in zip(SCREAMING_SNAKE_CASE_      ,							SCREAMING_SNAKE_CASE_     ):
																						self.assert_almost_equals(fx_output_loaded[:, -1]      ,							pt_output[:, -1].numpy()      ,							4E-2     )







						@is_pt_flax_cross_test
						def lowerCAmelCase__ (  self:	List[str]     )							->	Any:
										__magic_name__       ,     __magic_name__				:					List[Any]						       =       self.model_tester.prepare_config_and_inputs_for_common()
										for model_class in self.all_model_classes:
														with self.subTest(model_class.__name__     ):
																		# prepare inputs
																		__magic_name__				:					List[Any]						       =       self._prepare_for_class(SCREAMING_SNAKE_CASE_      ,							SCREAMING_SNAKE_CASE_     )
																		__magic_name__				:					str						       =       {k: torch.tensor(v.tolist()     ) for k, v in prepared_inputs_dict.items()}

																		# load corresponding PyTorch class
																		__magic_name__				:					Union[str, Any]						       =       model_class.__name__[4:]  # Skip the "Flax" at the beginning
																		__magic_name__				:					List[Any]						       =       getattr(SCREAMING_SNAKE_CASE_      ,							SCREAMING_SNAKE_CASE_     )

																		__magic_name__				:					int						       =       pt_model_class(SCREAMING_SNAKE_CASE_     ).eval()
																		__magic_name__				:					Dict						       =       False
																		__magic_name__				:					Tuple						       =       model_class(SCREAMING_SNAKE_CASE_      ,							dtype=jnp.floataa     )

																		__magic_name__				:					Tuple						       =       load_flax_weights_in_pytorch_model(SCREAMING_SNAKE_CASE_      ,							fx_model.params     )
																		__magic_name__       ,     __magic_name__				:					int						       =       pt_inputs["input_ids"].shape
																		__magic_name__				:					int						       =       np.random.randint(0      ,							seq_length - 1      ,							size=(batch_size,)     )
																		for batch_idx, start_index in enumerate(SCREAMING_SNAKE_CASE_     ):
																						__magic_name__				:					Any						       =       0
																						__magic_name__				:					List[Any]						       =       1
																						__magic_name__				:					Dict						       =       0
																						__magic_name__				:					List[Any]						       =       1

																		# make sure weights are tied in PyTorch
																		pt_model.tie_weights()

																		with torch.no_grad():
																						__magic_name__				:					Dict						       =       pt_model(**SCREAMING_SNAKE_CASE_     ).to_tuple()

																		__magic_name__				:					Union[str, Any]						       =       fx_model(**SCREAMING_SNAKE_CASE_     ).to_tuple()
																		self.assertEqual(len(SCREAMING_SNAKE_CASE_     )      ,							len(SCREAMING_SNAKE_CASE_     )      ,							"Output lengths differ between Flax and PyTorch"     )
																		for fx_output, pt_output in zip(SCREAMING_SNAKE_CASE_      ,							SCREAMING_SNAKE_CASE_     ):
																						self.assert_almost_equals(fx_output[:, -1]      ,							pt_output[:, -1].numpy()      ,							4E-2     )

																		with tempfile.TemporaryDirectory() as tmpdirname:
																						fx_model.save_pretrained(SCREAMING_SNAKE_CASE_     )
																						__magic_name__				:					str						       =       pt_model_class.from_pretrained(SCREAMING_SNAKE_CASE_      ,							from_flax=SCREAMING_SNAKE_CASE_     )

																		with torch.no_grad():
																						__magic_name__				:					str						       =       pt_model_loaded(**SCREAMING_SNAKE_CASE_     ).to_tuple()

																		self.assertEqual(
																		    len(SCREAMING_SNAKE_CASE_     )      ,							len(SCREAMING_SNAKE_CASE_     )      ,							"Output lengths differ between Flax and PyTorch"     )
																		for fx_output, pt_output in zip(SCREAMING_SNAKE_CASE_      ,							SCREAMING_SNAKE_CASE_     ):
																						self.assert_almost_equals(fx_output[:, -1]      ,							pt_output[:, -1].numpy()      ,							4E-2     )







						@slow
						def lowerCAmelCase__ (  self:	int     )							->	str:
										for model_class_name in self.all_model_classes:
														__magic_name__				:					List[Any]						       =       model_class_name.from_pretrained("facebook/xglm-564M"     )
														__magic_name__				:					Any						       =       model(np.ones((1, 1)     )     )
														self.assertIsNotNone(SCREAMING_SNAKE_CASE_     )



'''simple docstring'''







import unittest
from dataclasses import dataclass
from typing import Optional

from transformers.utils import ModelOutput






@dataclass
class 		_snake_case    (				snake_case_		):






						'''simple docstring'''







						__snake_case   =      42
						__snake_case   =      None
						__snake_case   =      None






class 		_snake_case    (				unittest.TestCase		):






						'''simple docstring'''







						def lowerCAmelCase__ (  self:	List[str]     )							->	str:
										__magic_name__				:					List[Any]						       =       ModelOutputTest(a=30     )
										self.assertEqual(x.a      ,							30     )
										self.assertIsNone(x.b     )
										self.assertIsNone(x.c     )
										with self.assertRaises(__UpperCamelCase     ):
														__magic_name__				:					Optional[int]						       =       x.d







						def lowerCAmelCase__ (  self:	Dict     )							->	Dict:
										__magic_name__				:					List[Any]						       =       ModelOutputTest(a=30      ,							b=10     )
										self.assertEqual(x[0]      ,							30     )
										self.assertEqual(x[1]      ,							10     )
										self.assertEqual(x[:2]      ,							(30, 10)     )
										self.assertEqual(x[:]      ,							(30, 10)     )

										__magic_name__				:					str						       =       ModelOutputTest(a=30      ,							c=10     )
										self.assertEqual(x[0]      ,							30     )
										self.assertEqual(x[1]      ,							10     )
										self.assertEqual(x[:2]      ,							(30, 10)     )
										self.assertEqual(x[:]      ,							(30, 10)     )







						def lowerCAmelCase__ (  self:	List[Any]     )							->	Optional[int]:
										__magic_name__				:					Optional[Any]						       =       ModelOutputTest(a=30      ,							b=10     )
										self.assertEqual(x["a"]      ,							30     )
										self.assertEqual(x["b"]      ,							10     )
										with self.assertRaises(__UpperCamelCase     ):
														__magic_name__				:					str						       =       x["c"]

										__magic_name__				:					Optional[Any]						       =       ModelOutputTest(a=30      ,							c=10     )
										self.assertEqual(x["a"]      ,							30     )
										self.assertEqual(x["c"]      ,							10     )
										with self.assertRaises(__UpperCamelCase     ):
														__magic_name__				:					Union[str, Any]						       =       x["b"]







						def lowerCAmelCase__ (  self:	Optional[Any]     )							->	Any:
										__magic_name__				:					Any						       =       ModelOutputTest(a=30     )
										self.assertEqual(list(x.keys()     )      ,							["a"]     )
										self.assertEqual(list(x.values()     )      ,							[30]     )
										self.assertEqual(list(x.items()     )      ,							[("a", 30)]     )
										self.assertEqual(list(__UpperCamelCase     )      ,							["a"]     )

										__magic_name__				:					Dict						       =       ModelOutputTest(a=30      ,							b=10     )
										self.assertEqual(list(x.keys()     )      ,							["a", "b"]     )
										self.assertEqual(list(x.values()     )      ,							[30, 10]     )
										self.assertEqual(list(x.items()     )      ,							[("a", 30), ("b", 10)]     )
										self.assertEqual(list(__UpperCamelCase     )      ,							["a", "b"]     )

										__magic_name__				:					int						       =       ModelOutputTest(a=30      ,							c=10     )
										self.assertEqual(list(x.keys()     )      ,							["a", "c"]     )
										self.assertEqual(list(x.values()     )      ,							[30, 10]     )
										self.assertEqual(list(x.items()     )      ,							[("a", 30), ("c", 10)]     )
										self.assertEqual(list(__UpperCamelCase     )      ,							["a", "c"]     )

										with self.assertRaises(__UpperCamelCase     ):
														__magic_name__				:					str						       =       x.update({"d": 20}     )
										with self.assertRaises(__UpperCamelCase     ):
														del x["a"]
										with self.assertRaises(__UpperCamelCase     ):
														__magic_name__				:					List[str]						       =       x.pop("a"     )
										with self.assertRaises(__UpperCamelCase     ):
														__magic_name__				:					Optional[Any]						       =       x.setdefault("d"      ,							32     )







						def lowerCAmelCase__ (  self:	Dict     )							->	int:
										__magic_name__				:					Any						       =       ModelOutputTest(a=30     )
										__magic_name__				:					Tuple						       =       10
										self.assertEqual(x.a      ,							10     )
										self.assertEqual(x["a"]      ,							10     )







						def lowerCAmelCase__ (  self:	Dict     )							->	Union[str, Any]:
										__magic_name__				:					Tuple						       =       ModelOutputTest(a=30     )
										__magic_name__				:					Union[str, Any]						       =       10
										self.assertEqual(x.a      ,							10     )
										self.assertEqual(x["a"]      ,							10     )







						def lowerCAmelCase__ (  self:	Optional[int]     )							->	Optional[int]:
										__magic_name__				:					Tuple						       =       ModelOutputTest({"a": 30, "b": 10}     )
										self.assertEqual(list(x.keys()     )      ,							["a", "b"]     )
										self.assertEqual(x.a      ,							30     )
										self.assertEqual(x.b      ,							10     )







						def lowerCAmelCase__ (  self:	Optional[int]     )							->	Optional[Any]:
										__magic_name__				:					List[str]						       =       ModelOutputTest([("a", 30), ("b", 10)]     )
										self.assertEqual(list(x.keys()     )      ,							["a", "b"]     )
										self.assertEqual(x.a      ,							30     )
										self.assertEqual(x.b      ,							10     )

										with self.assertRaises(__UpperCamelCase     ):
														__magic_name__				:					Any						       =       ModelOutputTest([("a", 30), (10, 10)]     )

										__magic_name__				:					Any						       =       ModelOutputTest(a=(30, 30)     )
										self.assertEqual(list(x.keys()     )      ,							["a"]     )
										self.assertEqual(x.a      ,							(30, 30)     )