

from __future__ import annotations

import unittest

from transformers import is_tf_available
from transformers.testing_utils import require_tf, slow

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
  import tensorflow as tf

  from transformers import (
      TF_XLM_PRETRAINED_MODEL_ARCHIVE_LIST,
      TFXLMForMultipleChoice,
      TFXLMForQuestionAnsweringSimple,
      TFXLMForSequenceClassification,
      TFXLMForTokenClassification,
      TFXLMModel,
      TFXLMWithLMHeadModel,
      XLMConfig,
  )







class 							a__							:







  """simple docstring"""




  def __init__(      self     :			List[Any]					,					UpperCAmelCase__     :			Any					,					)       ->List[str]:
        """simple docstring"""







        SCREAMING_SNAKE_CASE			:   Optional[Any]	  = parent
        SCREAMING_SNAKE_CASE			:   Any	  = 1_3
        SCREAMING_SNAKE_CASE			:   Dict	  = 7
        SCREAMING_SNAKE_CASE			:   str	  = True
        SCREAMING_SNAKE_CASE			:   Optional[int]	  = True
        SCREAMING_SNAKE_CASE			:   Optional[Any]	  = True
        SCREAMING_SNAKE_CASE			:   Tuple	  = True
        SCREAMING_SNAKE_CASE			:   Tuple	  = True
        SCREAMING_SNAKE_CASE			:   str	  = False
        SCREAMING_SNAKE_CASE			:   Optional[Any]	  = False
        SCREAMING_SNAKE_CASE			:   Any	  = False
        SCREAMING_SNAKE_CASE			:   Tuple	  = 2
        SCREAMING_SNAKE_CASE			:   str	  = 9_9
        SCREAMING_SNAKE_CASE			:   str	  = 0
        SCREAMING_SNAKE_CASE			:   Dict	  = 3_2
        SCREAMING_SNAKE_CASE			:   Dict	  = 2
        SCREAMING_SNAKE_CASE			:   Union[str, Any]	  = 4
        SCREAMING_SNAKE_CASE			:   Union[str, Any]	  = 0.1
        SCREAMING_SNAKE_CASE			:   Dict	  = 0.1
        SCREAMING_SNAKE_CASE			:   Optional[Any]	  = 5_1_2
        SCREAMING_SNAKE_CASE			:   Any	  = 1_6
        SCREAMING_SNAKE_CASE			:   Tuple	  = 2
        SCREAMING_SNAKE_CASE			:   int	  = 0.02
        SCREAMING_SNAKE_CASE			:   Union[str, Any]	  = 3
        SCREAMING_SNAKE_CASE			:   str	  = 4
        SCREAMING_SNAKE_CASE			:   Union[str, Any]	  = "last"
        SCREAMING_SNAKE_CASE			:   Optional[int]	  = True
        SCREAMING_SNAKE_CASE			:   str	  = None
        SCREAMING_SNAKE_CASE			:   Dict	  = 0


  def 			_lowercase   (      self     :			List[Any]		)       ->int:
        """simple docstring"""







        SCREAMING_SNAKE_CASE			:   Optional[int]	  = ids_tensor([self.batch_size, self.seq_length]					,					self.vocab_size		)
        SCREAMING_SNAKE_CASE			:   Any	  = random_attention_mask([self.batch_size, self.seq_length]					,					dtype=tf.floataa		)

        SCREAMING_SNAKE_CASE			:   Union[str, Any]	  = None
        if self.use_input_lengths:
              SCREAMING_SNAKE_CASE			:   Dict	  = (
                  ids_tensor([self.batch_size]					,					vocab_size=2		) + self.seq_length - 2
              )  # small variation of seq_length

        SCREAMING_SNAKE_CASE			:   Union[str, Any]	  = None
        if self.use_token_type_ids:
              SCREAMING_SNAKE_CASE			:   int	  = ids_tensor([self.batch_size, self.seq_length]					,					self.n_langs		)

        SCREAMING_SNAKE_CASE			:   Dict	  = None
        SCREAMING_SNAKE_CASE			:   int	  = None
        SCREAMING_SNAKE_CASE			:   str	  = None
        if self.use_labels:
              SCREAMING_SNAKE_CASE			:   Optional[Any]	  = ids_tensor([self.batch_size]					,					self.type_sequence_label_size		)
              SCREAMING_SNAKE_CASE			:   Optional[int]	  = ids_tensor([self.batch_size, self.seq_length]					,					self.num_labels		)
              SCREAMING_SNAKE_CASE			:   Optional[int]	  = ids_tensor([self.batch_size]					,					2					,					dtype=tf.floataa		)
              SCREAMING_SNAKE_CASE			:   Dict	  = ids_tensor([self.batch_size]					,					self.num_choices		)

        SCREAMING_SNAKE_CASE			:   Optional[Any]	  = XLMConfig(
            vocab_size=self.vocab_size					,					n_special=self.n_special					,					emb_dim=self.hidden_size					,					n_layers=self.num_hidden_layers					,					n_heads=self.num_attention_heads					,					dropout=self.hidden_dropout_prob					,					attention_dropout=self.attention_probs_dropout_prob					,					gelu_activation=self.gelu_activation					,					sinusoidal_embeddings=self.sinusoidal_embeddings					,					asm=self.asm					,					causal=self.causal					,					n_langs=self.n_langs					,					max_position_embeddings=self.max_position_embeddings					,					initializer_range=self.initializer_range					,					summary_type=self.summary_type					,					use_proj=self.use_proj					,					bos_token_id=self.bos_token_id					,					)

        return (
            config,
            input_ids,
            token_type_ids,
            input_lengths,
            sequence_labels,
            token_labels,
            is_impossible_labels,
            choice_labels,
            input_mask,
        )


  def 			_lowercase   (      self     :			Any					,					UpperCAmelCase__     :			Tuple					,					UpperCAmelCase__     :			Dict					,					UpperCAmelCase__     :			Union[str, Any]					,					UpperCAmelCase__     :			Dict					,					UpperCAmelCase__     :			int					,					UpperCAmelCase__     :			Union[str, Any]					,					UpperCAmelCase__     :			Optional[int]					,					UpperCAmelCase__     :			str					,					UpperCAmelCase__     :			str					,					)       ->Dict:
        """simple docstring"""







        SCREAMING_SNAKE_CASE			:   Optional[Any]	  = TFXLMModel(config=lowercase_		)
        SCREAMING_SNAKE_CASE			:   Any	  = {"input_ids": input_ids, "lengths": input_lengths, "langs": token_type_ids}
        SCREAMING_SNAKE_CASE			:   Tuple	  = model(lowercase_		)

        SCREAMING_SNAKE_CASE			:   Any	  = [input_ids, input_mask]
        SCREAMING_SNAKE_CASE			:   Union[str, Any]	  = model(lowercase_		)
        self.parent.assertEqual(result.last_hidden_state.shape					,					(self.batch_size, self.seq_length, self.hidden_size)		)


  def 			_lowercase   (      self     :			str					,					UpperCAmelCase__     :			List[str]					,					UpperCAmelCase__     :			Any					,					UpperCAmelCase__     :			Union[str, Any]					,					UpperCAmelCase__     :			Tuple					,					UpperCAmelCase__     :			int					,					UpperCAmelCase__     :			List[str]					,					UpperCAmelCase__     :			Union[str, Any]					,					UpperCAmelCase__     :			List[str]					,					UpperCAmelCase__     :			Tuple					,					)       ->Optional[Any]:
        """simple docstring"""







        SCREAMING_SNAKE_CASE			:   Tuple	  = TFXLMWithLMHeadModel(lowercase_		)

        SCREAMING_SNAKE_CASE			:   List[Any]	  = {"input_ids": input_ids, "lengths": input_lengths, "langs": token_type_ids}
        SCREAMING_SNAKE_CASE			:   Dict	  = model(lowercase_		)

        SCREAMING_SNAKE_CASE			:   Optional[int]	  = outputs

        self.parent.assertEqual(result.logits.shape					,					(self.batch_size, self.seq_length, self.vocab_size)		)


  def 			_lowercase   (      self     :			Any					,					UpperCAmelCase__     :			Dict					,					UpperCAmelCase__     :			List[Any]					,					UpperCAmelCase__     :			Any					,					UpperCAmelCase__     :			int					,					UpperCAmelCase__     :			Tuple					,					UpperCAmelCase__     :			Dict					,					UpperCAmelCase__     :			Optional[int]					,					UpperCAmelCase__     :			str					,					UpperCAmelCase__     :			Union[str, Any]					,					)       ->Any:
        """simple docstring"""







        SCREAMING_SNAKE_CASE			:   int	  = TFXLMForQuestionAnsweringSimple(lowercase_		)

        SCREAMING_SNAKE_CASE			:   Any	  = {"input_ids": input_ids, "lengths": input_lengths}

        SCREAMING_SNAKE_CASE			:   Union[str, Any]	  = model(lowercase_		)

        self.parent.assertEqual(result.start_logits.shape					,					(self.batch_size, self.seq_length)		)
        self.parent.assertEqual(result.end_logits.shape					,					(self.batch_size, self.seq_length)		)


  def 			_lowercase   (      self     :			int					,					UpperCAmelCase__     :			List[str]					,					UpperCAmelCase__     :			str					,					UpperCAmelCase__     :			Union[str, Any]					,					UpperCAmelCase__     :			Union[str, Any]					,					UpperCAmelCase__     :			int					,					UpperCAmelCase__     :			List[Any]					,					UpperCAmelCase__     :			List[Any]					,					UpperCAmelCase__     :			List[str]					,					UpperCAmelCase__     :			Tuple					,					)       ->Optional[int]:
        """simple docstring"""







        SCREAMING_SNAKE_CASE			:   Union[str, Any]	  = TFXLMForSequenceClassification(lowercase_		)

        SCREAMING_SNAKE_CASE			:   Optional[int]	  = {"input_ids": input_ids, "lengths": input_lengths}

        SCREAMING_SNAKE_CASE			:   Any	  = model(lowercase_		)

        self.parent.assertEqual(result.logits.shape					,					(self.batch_size, self.type_sequence_label_size)		)


  def 			_lowercase   (      self     :			Union[str, Any]					,					UpperCAmelCase__     :			List[str]					,					UpperCAmelCase__     :			int					,					UpperCAmelCase__     :			Union[str, Any]					,					UpperCAmelCase__     :			Optional[Any]					,					UpperCAmelCase__     :			Union[str, Any]					,					UpperCAmelCase__     :			int					,					UpperCAmelCase__     :			Union[str, Any]					,					UpperCAmelCase__     :			Dict					,					UpperCAmelCase__     :			Tuple					,					)       ->int:
        """simple docstring"""







        SCREAMING_SNAKE_CASE			:   Dict	  = self.num_labels
        SCREAMING_SNAKE_CASE			:   Any	  = TFXLMForTokenClassification(config=lowercase_		)
        SCREAMING_SNAKE_CASE			:   Any	  = {"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
        SCREAMING_SNAKE_CASE			:   List[Any]	  = model(lowercase_		)
        self.parent.assertEqual(result.logits.shape					,					(self.batch_size, self.seq_length, self.num_labels)		)


  def 			_lowercase   (      self     :			Optional[Any]					,					UpperCAmelCase__     :			Tuple					,					UpperCAmelCase__     :			int					,					UpperCAmelCase__     :			Optional[Any]					,					UpperCAmelCase__     :			Optional[int]					,					UpperCAmelCase__     :			List[Any]					,					UpperCAmelCase__     :			List[str]					,					UpperCAmelCase__     :			List[Any]					,					UpperCAmelCase__     :			int					,					UpperCAmelCase__     :			Optional[int]					,					)       ->int:
        """simple docstring"""







        SCREAMING_SNAKE_CASE			:   Any	  = self.num_choices
        SCREAMING_SNAKE_CASE			:   Any	  = TFXLMForMultipleChoice(config=lowercase_		)
        SCREAMING_SNAKE_CASE			:   Union[str, Any]	  = tf.tile(tf.expand_dims(lowercase_					,					1		)					,					(1, self.num_choices, 1)		)
        SCREAMING_SNAKE_CASE			:   Any	  = tf.tile(tf.expand_dims(lowercase_					,					1		)					,					(1, self.num_choices, 1)		)
        SCREAMING_SNAKE_CASE			:   int	  = tf.tile(tf.expand_dims(lowercase_					,					1		)					,					(1, self.num_choices, 1)		)
        SCREAMING_SNAKE_CASE			:   Any	  = {
            "input_ids": multiple_choice_inputs_ids,
            "attention_mask": multiple_choice_input_mask,
            "token_type_ids": multiple_choice_token_type_ids,
        }
        SCREAMING_SNAKE_CASE			:   int	  = model(lowercase_		)
        self.parent.assertEqual(result.logits.shape					,					(self.batch_size, self.num_choices)		)




  def 			_lowercase   (      self     :			str		)       ->List[Any]:
        """simple docstring"""







        SCREAMING_SNAKE_CASE			:   List[str]	  = self.prepare_config_and_inputs()
        (
            SCREAMING_SNAKE_CASE  
        )			:   Dict	  = config_and_inputs
        SCREAMING_SNAKE_CASE			:   Optional[int]	  = {
            "input_ids": input_ids,
            "token_type_ids": token_type_ids,
            "langs": token_type_ids,
            "lengths": input_lengths,
        }
        return config, inputs_dict







@require_tf
class 							a__							( lowercase__						,      lowercase__						,      unittest.TestCase							):







  """simple docstring"""




  UpperCAmelCase__   :			Any      							=(
      (
          TFXLMModel,
          TFXLMWithLMHeadModel,
          TFXLMForSequenceClassification,
          TFXLMForQuestionAnsweringSimple,
          TFXLMForTokenClassification,
          TFXLMForMultipleChoice,
      )
      if is_tf_available()
      else ()
  )
  UpperCAmelCase__   :			List[Any]      							=(
      (TFXLMWithLMHeadModel,) if is_tf_available() else ()
  )  # TODO (PVP): Check other models whether language generation is also applicable
  UpperCAmelCase__   :			Any      							=(
      {
          """feature-extraction""": TFXLMModel,
          """fill-mask""": TFXLMWithLMHeadModel,
          """question-answering""": TFXLMForQuestionAnsweringSimple,
          """text-classification""": TFXLMForSequenceClassification,
          """text-generation""": TFXLMWithLMHeadModel,
          """token-classification""": TFXLMForTokenClassification,
          """zero-shot""": TFXLMForSequenceClassification,
      }
      if is_tf_available()
      else {}
  )
  UpperCAmelCase__   :			List[str]      							=False
  UpperCAmelCase__   :			Optional[Any]      							=False


  def 			_lowercase   (      self     :			List[Any]					,					UpperCAmelCase__     :			str					,					UpperCAmelCase__     :			Tuple					,					UpperCAmelCase__     :			Any					,					UpperCAmelCase__     :			Optional[Any]					,					UpperCAmelCase__     :			str		)       ->Any:
        """simple docstring"""







        if (
            pipeline_test_casse_name == "QAPipelineTests"
            and tokenizer_name is not None
            and not tokenizer_name.endswith("""Fast"""		)
        ):
              # `QAPipelineTests` fails for a few models when the slower tokenizer are used.
              # (The slower tokenizers were never used for pipeline tests before the pipeline testing rework)
              # TODO: check (and possibly fix) the `QAPipelineTests` with slower tokenizer
              return True

        return False


  def 			_lowercase   (      self     :			Dict		)       ->Tuple:
        """simple docstring"""







        SCREAMING_SNAKE_CASE			:   List[Any]	  = TFXLMModelTester(self		)
        SCREAMING_SNAKE_CASE			:   List[str]	  = ConfigTester(self					,					config_class=lowercase_					,					emb_dim=3_7		)


  def 			_lowercase   (      self     :			Tuple		)       ->Any:
        """simple docstring"""







        self.config_tester.run_common_tests()


  def 			_lowercase   (      self     :			Any		)       ->List[str]:
        """simple docstring"""







        SCREAMING_SNAKE_CASE			:   Optional[int]	  = self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_xlm_model(*lowercase_		)


  def 			_lowercase   (      self     :			Dict		)       ->List[str]:
        """simple docstring"""







        SCREAMING_SNAKE_CASE			:   int	  = self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_xlm_lm_head(*lowercase_		)


  def 			_lowercase   (      self     :			Optional[int]		)       ->int:
        """simple docstring"""







        SCREAMING_SNAKE_CASE			:   Optional[Any]	  = self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_xlm_qa(*lowercase_		)


  def 			_lowercase   (      self     :			Optional[Any]		)       ->List[Any]:
        """simple docstring"""







        SCREAMING_SNAKE_CASE			:   Optional[Any]	  = self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_xlm_sequence_classif(*lowercase_		)


  def 			_lowercase   (      self     :			int		)       ->Optional[Any]:
        """simple docstring"""







        SCREAMING_SNAKE_CASE			:   Optional[int]	  = self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_xlm_for_token_classification(*lowercase_		)


  def 			_lowercase   (      self     :			Any		)       ->str:
        """simple docstring"""







        SCREAMING_SNAKE_CASE			:   Dict	  = self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_xlm_for_multiple_choice(*lowercase_		)




  @slow
  def 			_lowercase   (      self     :			Dict		)       ->List[Any]:
        """simple docstring"""







        for model_name in TF_XLM_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
              SCREAMING_SNAKE_CASE			:   Tuple	  = TFXLMModel.from_pretrained(lowercase_		)
              self.assertIsNotNone(lowercase_		)







@require_tf
class 							a__							( unittest.TestCase							):







  """simple docstring"""




  @slow
  def 			_lowercase   (      self     :			Tuple		)       ->Union[str, Any]:
        """simple docstring"""







        SCREAMING_SNAKE_CASE			:   Union[str, Any]	  = TFXLMWithLMHeadModel.from_pretrained("""xlm-mlm-en-2048"""		)
        SCREAMING_SNAKE_CASE			:   Optional[Any]	  = tf.convert_to_tensor([[1_4, 4_4_7]]					,					dtype=tf.intaa		)  # the president
        SCREAMING_SNAKE_CASE			:   Optional[int]	  = [
            1_4,
            4_4_7,
            1_4,
            4_4_7,
            1_4,
            4_4_7,
            1_4,
            4_4_7,
            1_4,
            4_4_7,
            1_4,
            4_4_7,
            1_4,
            4_4_7,
            1_4,
            4_4_7,
            1_4,
            4_4_7,
            1_4,
            4_4_7,
        ]  # the president the president the president the president the president the president the president the president the president the president
        # TODO(PVP): this and other input_ids I tried for generation give pretty bad results. Not sure why. Model might just not be made for auto-regressive inference
        SCREAMING_SNAKE_CASE			:   str	  = model.generate(lowercase_					,					do_sample=lowercase_		)
        self.assertListEqual(output_ids[0].numpy().tolist()					,					lowercase_		)






"""simple docstring"""





class A_      :




  '''simple docstring'''







  def __init__(						self							,  lowercase_    ):

     """simple docstring"""
     UpperCAmelCase_   :   str     	=       data
     UpperCAmelCase_   :   str     	=       None
     UpperCAmelCase_   :   List[Any]     	=       None







  def __str__(						self    ):

     """simple docstring"""
     return F"""{self.data}"""




class A_      :




  '''simple docstring'''







  def __init__(						self    ):

     """simple docstring"""
     UpperCAmelCase_   :   Tuple     	=       None
     UpperCAmelCase_   :   List[str]     	=       None







  def __iter__(						self    ):

     """simple docstring"""
     UpperCAmelCase_   :   Optional[int]     	=       self.head
     while node:
        yield node.data
        UpperCAmelCase_   :   Optional[Any]     	=       node.next







  def __str__(						self    ):

     """simple docstring"""
     return "->".join([str(lowercase_    ) for item in self]    )







  def __len__(						self    ):

     """simple docstring"""
     return sum(1 for _ in self    )







  def 			UpperCamelCase__   (						self							,  lowercase_    ):

     """simple docstring"""
     self.insert_at_nth(0							,  lowercase_    )







  def 			UpperCamelCase__   (						self							,  lowercase_    ):

     """simple docstring"""
     self.insert_at_nth(len(self    )							,  lowercase_    )







  def 			UpperCamelCase__   (						self							,  lowercase_							,  lowercase_    ):

     """simple docstring"""
     UpperCAmelCase_   :   int     	=       len(self    )

     if not 0 <= index <= length:
        raise IndexError("list index out of range"    )
     UpperCAmelCase_   :   Tuple     	=       Node(lowercase_    )
     if self.head is None:
        UpperCAmelCase_   :   List[str]     	=       new_node
     elif index == 0:
        UpperCAmelCase_   :   int     	=       new_node
        UpperCAmelCase_   :   Optional[Any]     	=       self.head
        UpperCAmelCase_   :   Optional[int]     	=       new_node
     elif index == length:
        UpperCAmelCase_   :   Union[str, Any]     	=       new_node
        UpperCAmelCase_   :   Optional[Any]     	=       self.tail
        UpperCAmelCase_   :   Tuple     	=       new_node
     else:
        UpperCAmelCase_   :   Dict     	=       self.head
        for _ in range(0							,  lowercase_    ):
           UpperCAmelCase_   :   str     	=       temp.next
        UpperCAmelCase_   :   int     	=       new_node
        UpperCAmelCase_   :   Tuple     	=       temp.previous
        UpperCAmelCase_   :   Union[str, Any]     	=       temp
        UpperCAmelCase_   :   int     	=       new_node







  def 			UpperCamelCase__   (						self    ):

     """simple docstring"""
     return self.delete_at_nth(0    )







  def 			UpperCamelCase__   (						self    ):

     """simple docstring"""
     return self.delete_at_nth(len(self    ) - 1    )







  def 			UpperCamelCase__   (						self							,  lowercase_    ):

     """simple docstring"""
     UpperCAmelCase_   :   int     	=       len(self    )

     if not 0 <= index <= length - 1:
        raise IndexError("list index out of range"    )
     UpperCAmelCase_   :   Optional[int]     	=       self.head  # default first node
     if length == 1:
        UpperCAmelCase_   :   Union[str, Any]     	=       None
     elif index == 0:
        UpperCAmelCase_   :   List[Any]     	=       self.head.next
        UpperCAmelCase_   :   str     	=       None
     elif index == length - 1:
        UpperCAmelCase_   :   str     	=       self.tail
        UpperCAmelCase_   :   Optional[Any]     	=       self.tail.previous
        UpperCAmelCase_   :   Any     	=       None
     else:
        UpperCAmelCase_   :   List[Any]     	=       self.head
        for _ in range(0							,  lowercase_    ):
           UpperCAmelCase_   :   str     	=       temp.next
        UpperCAmelCase_   :   Dict     	=       temp
        UpperCAmelCase_   :   Optional[Any]     	=       temp.previous
        UpperCAmelCase_   :   int     	=       temp.next
     return delete_node.data







  def 			UpperCamelCase__   (						self							,  lowercase_    ):

     """simple docstring"""
     UpperCAmelCase_   :   Tuple     	=       self.head

     while current.data != data:  # Find the position to delete
        if current.next:
           UpperCAmelCase_   :   List[str]     	=       current.next
        else:  # We have reached the end an no value matches
           raise ValueError("No data matching given value"    )

     if current == self.head:
        self.delete_head()

     elif current == self.tail:
        self.delete_tail()

     else:  # Before: 1 <--> 2(current) <--> 3
        UpperCAmelCase_   :   str     	=       current.next  # 1 --> 3
        UpperCAmelCase_   :   Optional[Any]     	=       current.previous  # 1 <--> 3
     return data







  def 			UpperCamelCase__   (						self    ):

     """simple docstring"""
     return len(self    ) == 0







def       __a	(						):
   UpperCAmelCase_   :   Dict     	=       DoublyLinkedList()
   assert linked_list.is_empty() is True
   assert str(__lowerCamelCase    ) == ""

   try:
      linked_list.delete_head()
      raise AssertionError  # This should not happen.
   except IndexError:
      assert True  # This should happen.

   try:
      linked_list.delete_tail()
      raise AssertionError  # This should not happen.
   except IndexError:
      assert True  # This should happen.

   for i in range(10    ):
      assert len(__lowerCamelCase    ) == i
      linked_list.insert_at_nth(__lowerCamelCase,						i + 1    )
   assert str(__lowerCamelCase    ) == "->".join(str(__lowerCamelCase    ) for i in range(1,						11    )    )

   linked_list.insert_at_head(0    )
   linked_list.insert_at_tail(11    )
   assert str(__lowerCamelCase    ) == "->".join(str(__lowerCamelCase    ) for i in range(0,						12    )    )

   assert linked_list.delete_head() == 0
   assert linked_list.delete_at_nth(9    ) == 10
   assert linked_list.delete_tail() == 11
   assert len(__lowerCamelCase    ) == 9
   assert str(__lowerCamelCase    ) == "->".join(str(__lowerCamelCase    ) for i in range(1,						10    )    )


if __name__ == "__main__":
    from doctest import testmod

    testmod()


