

import inspect
import unittest

from transformers import BitConfig
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_vision_available

from ...test_backbone_common import BackboneTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
						import torch
						from torch import nn

						from transformers import BitBackbone, BitForImageClassification, BitImageProcessor, BitModel
						from transformers.models.bit.modeling_bit import BIT_PRETRAINED_MODEL_ARCHIVE_LIST


if is_vision_available():
						from PIL import Image



class   __lowercase				:




			"""simple docstring"""







			def __init__( self  :     Optional[Any]   ,						lowerCAmelCase__  :     Optional[Any]   ,						lowerCAmelCase__  :     List[Any]=3   ,						lowerCAmelCase__  :     List[Any]=32   ,						lowerCAmelCase__  :     Any=3   ,						lowerCAmelCase__  :     Optional[Any]=10   ,						lowerCAmelCase__  :     Any=[8, 16, 32, 64]   ,						lowerCAmelCase__  :     Tuple=[1, 1, 2, 1]   ,						lowerCAmelCase__  :     List[str]=True   ,						lowerCAmelCase__  :     Dict=True   ,						lowerCAmelCase__  :     Optional[int]="relu"   ,						lowerCAmelCase__  :     str=3   ,						lowerCAmelCase__  :     List[str]=None   ,						lowerCAmelCase__  :     List[Any]=["stage2", "stage3", "stage4"]   ,						lowerCAmelCase__  :     List[str]=[2, 3, 4]   ,						lowerCAmelCase__  :     int=1   ,						):
									SCREAMING_SNAKE_CASE_: Tuple  		=       parent
									SCREAMING_SNAKE_CASE_: str  		=       batch_size
									SCREAMING_SNAKE_CASE_: List[Any]  		=       image_size
									SCREAMING_SNAKE_CASE_: Optional[int]  		=       num_channels
									SCREAMING_SNAKE_CASE_: Union[str, Any]  		=       embeddings_size
									SCREAMING_SNAKE_CASE_: Tuple  		=       hidden_sizes
									SCREAMING_SNAKE_CASE_: str  		=       depths
									SCREAMING_SNAKE_CASE_: Dict  		=       is_training
									SCREAMING_SNAKE_CASE_: Tuple  		=       use_labels
									SCREAMING_SNAKE_CASE_: List[str]  		=       hidden_act
									SCREAMING_SNAKE_CASE_: Optional[int]  		=       num_labels
									SCREAMING_SNAKE_CASE_: Optional[int]  		=       scope
									SCREAMING_SNAKE_CASE_: Union[str, Any]  		=       len(lowerCAmelCase__)
									SCREAMING_SNAKE_CASE_: Dict  		=       out_features
									SCREAMING_SNAKE_CASE_: Any  		=       out_indices
									SCREAMING_SNAKE_CASE_: str  		=       num_groups



			def        _SCREAMING_SNAKE_CASE			( self  :     Tuple):
									SCREAMING_SNAKE_CASE_: Union[str, Any]  		=       floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size])

									SCREAMING_SNAKE_CASE_: int  		=       None
									if self.use_labels:
															SCREAMING_SNAKE_CASE_: List[Any]  		=       ids_tensor([self.batch_size]   ,						self.num_labels)

									SCREAMING_SNAKE_CASE_: str  		=       self.get_config()

									return config, pixel_values, labels



			def        _SCREAMING_SNAKE_CASE			( self  :     Optional[Any]):
									return BitConfig(
									    num_channels=self.num_channels   ,						embeddings_size=self.embeddings_size   ,						hidden_sizes=self.hidden_sizes   ,						depths=self.depths   ,						hidden_act=self.hidden_act   ,						num_labels=self.num_labels   ,						out_features=self.out_features   ,						out_indices=self.out_indices   ,						num_groups=self.num_groups   ,						)



			def        _SCREAMING_SNAKE_CASE			( self  :     List[str]   ,						lowerCAmelCase__  :     str   ,						lowerCAmelCase__  :     str   ,						lowerCAmelCase__  :     Optional[int]):
									SCREAMING_SNAKE_CASE_: List[Any]  		=       BitModel(config=lowerCAmelCase__)
									model.to(lowerCAmelCase__)
									model.eval()
									SCREAMING_SNAKE_CASE_: Optional[Any]  		=       model(lowerCAmelCase__)
									self.parent.assertEqual(
									    result.last_hidden_state.shape   ,						(self.batch_size, self.hidden_sizes[-1], self.image_size // 32, self.image_size // 32)   ,						)



			def        _SCREAMING_SNAKE_CASE			( self  :     str   ,						lowerCAmelCase__  :     int   ,						lowerCAmelCase__  :     List[Any]   ,						lowerCAmelCase__  :     int):
									SCREAMING_SNAKE_CASE_: Optional[Any]  		=       self.num_labels
									SCREAMING_SNAKE_CASE_: Tuple  		=       BitForImageClassification(lowerCAmelCase__)
									model.to(lowerCAmelCase__)
									model.eval()
									SCREAMING_SNAKE_CASE_: Union[str, Any]  		=       model(lowerCAmelCase__   ,						labels=lowerCAmelCase__)
									self.parent.assertEqual(result.logits.shape   ,						(self.batch_size, self.num_labels))



			def        _SCREAMING_SNAKE_CASE			( self  :     Union[str, Any]   ,						lowerCAmelCase__  :     Union[str, Any]   ,						lowerCAmelCase__  :     Optional[Any]   ,						lowerCAmelCase__  :     Union[str, Any]):
									SCREAMING_SNAKE_CASE_: Dict  		=       BitBackbone(config=lowerCAmelCase__)
									model.to(lowerCAmelCase__)
									model.eval()
									SCREAMING_SNAKE_CASE_: Optional[Any]  		=       model(lowerCAmelCase__)

									# verify feature maps
									self.parent.assertEqual(len(result.feature_maps)   ,						len(config.out_features))
									self.parent.assertListEqual(list(result.feature_maps[0].shape)   ,						[self.batch_size, self.hidden_sizes[1], 4, 4])

									# verify channels
									self.parent.assertEqual(len(model.channels)   ,						len(config.out_features))
									self.parent.assertListEqual(model.channels   ,						config.hidden_sizes[1:])

									# verify backbone works with out_features=None
									SCREAMING_SNAKE_CASE_: Optional[Any]  		=       None
									SCREAMING_SNAKE_CASE_: Optional[int]  		=       BitBackbone(config=lowerCAmelCase__)
									model.to(lowerCAmelCase__)
									model.eval()
									SCREAMING_SNAKE_CASE_: List[str]  		=       model(lowerCAmelCase__)

									# verify feature maps
									self.parent.assertEqual(len(result.feature_maps)   ,						1)
									self.parent.assertListEqual(list(result.feature_maps[0].shape)   ,						[self.batch_size, self.hidden_sizes[-1], 1, 1])

									# verify channels
									self.parent.assertEqual(len(model.channels)   ,						1)
									self.parent.assertListEqual(model.channels   ,						[config.hidden_sizes[-1]])




			def        _SCREAMING_SNAKE_CASE			( self  :     str):
									SCREAMING_SNAKE_CASE_: Any  		=       self.prepare_config_and_inputs()
									SCREAMING_SNAKE_CASE_		,    SCREAMING_SNAKE_CASE_		,    SCREAMING_SNAKE_CASE_: Optional[int]  		=       config_and_inputs
									SCREAMING_SNAKE_CASE_: str  		=       {"pixel_values": pixel_values}
									return config, inputs_dict







@require_torch
class   __lowercase				( UpperCAmelCase_		,       UpperCAmelCase_		,       unittest.TestCase	):




			"""simple docstring"""







			_UpperCAmelCase   :							Dict										=     (BitModel, BitForImageClassification, BitBackbone) if is_torch_available() else ()
			_UpperCAmelCase   :							Optional[Any]										=     (
			    {'''feature-extraction''': BitModel, '''image-classification''': BitForImageClassification}
			    if is_torch_available()
			    else {}
			)

			_UpperCAmelCase   :							List[Any]										=     False
			_UpperCAmelCase   :							List[str]										=     False
			_UpperCAmelCase   :							int										=     False
			_UpperCAmelCase   :							Union[str, Any]										=     False
			_UpperCAmelCase   :							str										=     False



			def        _SCREAMING_SNAKE_CASE			( self  :     List[Any]):
									SCREAMING_SNAKE_CASE_: Optional[int]  		=       BitModelTester(self)
									SCREAMING_SNAKE_CASE_: Dict  		=       ConfigTester(self   ,						config_class=lowerCAmelCase__   ,						has_text_modality=lowerCAmelCase__)



			def        _SCREAMING_SNAKE_CASE			( self  :     int):
									self.create_and_test_config_common_properties()
									self.config_tester.create_and_test_config_to_json_string()
									self.config_tester.create_and_test_config_to_json_file()
									self.config_tester.create_and_test_config_from_and_save_pretrained()
									self.config_tester.create_and_test_config_with_num_labels()
									self.config_tester.check_config_can_be_init_without_params()
									self.config_tester.check_config_arguments_init()



			def        _SCREAMING_SNAKE_CASE			( self  :     Dict):
									return



			@unittest.skip(reason="Bit does not output attentions")
			def        _SCREAMING_SNAKE_CASE			( self  :     Dict):
									pass



			@unittest.skip(reason="Bit does not use inputs_embeds")
			def        _SCREAMING_SNAKE_CASE			( self  :     Any):
									pass



			@unittest.skip(reason="Bit does not support input and output embeddings")
			def        _SCREAMING_SNAKE_CASE			( self  :     Tuple):
									pass



			def        _SCREAMING_SNAKE_CASE			( self  :     List[str]):
									SCREAMING_SNAKE_CASE_		,    SCREAMING_SNAKE_CASE_: List[Any]  		=       self.model_tester.prepare_config_and_inputs_for_common()

									for model_class in self.all_model_classes:
															SCREAMING_SNAKE_CASE_: List[Any]  		=       model_class(lowerCAmelCase__)
															SCREAMING_SNAKE_CASE_: Union[str, Any]  		=       inspect.signature(model.forward)
															# signature.parameters is an OrderedDict => so arg_names order is deterministic
															SCREAMING_SNAKE_CASE_: Tuple  		=       [*signature.parameters.keys()]

															SCREAMING_SNAKE_CASE_: Union[str, Any]  		=       ["pixel_values"]
															self.assertListEqual(arg_names[:1]   ,						lowerCAmelCase__)



			def        _SCREAMING_SNAKE_CASE			( self  :     List[Any]):
									SCREAMING_SNAKE_CASE_: Union[str, Any]  		=       self.model_tester.prepare_config_and_inputs()
									self.model_tester.create_and_check_model(*lowerCAmelCase__)



			def        _SCREAMING_SNAKE_CASE			( self  :     List[Any]):
									SCREAMING_SNAKE_CASE_: Union[str, Any]  		=       self.model_tester.prepare_config_and_inputs()
									self.model_tester.create_and_check_backbone(*lowerCAmelCase__)



			def        _SCREAMING_SNAKE_CASE			( self  :     Union[str, Any]):
									SCREAMING_SNAKE_CASE_		,    SCREAMING_SNAKE_CASE_: Any  		=       self.model_tester.prepare_config_and_inputs_for_common()

									for model_class in self.all_model_classes:
															SCREAMING_SNAKE_CASE_: int  		=       model_class(config=lowerCAmelCase__)
															for name, module in model.named_modules():
																					if isinstance(lowerCAmelCase__   ,						(nn.BatchNormad, nn.GroupNorm)):
																											self.assertTrue(
																											    torch.all(module.weight == 1)   ,						msg=F"Parameter {name} of model {model_class} seems not properly initialized"   ,						)
																											self.assertTrue(
																											    torch.all(module.bias == 0)   ,						msg=F"Parameter {name} of model {model_class} seems not properly initialized"   ,						)



			def        _SCREAMING_SNAKE_CASE			( self  :     List[str]):
									def check_hidden_states_output(lowerCAmelCase__  :     int   ,						lowerCAmelCase__  :     List[Any]   ,						lowerCAmelCase__  :     List[str]):
															SCREAMING_SNAKE_CASE_: Union[str, Any]  		=       model_class(lowerCAmelCase__)
															model.to(lowerCAmelCase__)
															model.eval()

															with torch.no_grad():
																					SCREAMING_SNAKE_CASE_: str  		=       model(**self._prepare_for_class(lowerCAmelCase__   ,						lowerCAmelCase__))

															SCREAMING_SNAKE_CASE_: str  		=       outputs.encoder_hidden_states if config.is_encoder_decoder else outputs.hidden_states

															SCREAMING_SNAKE_CASE_: List[str]  		=       self.model_tester.num_stages
															self.assertEqual(len(lowerCAmelCase__)   ,						expected_num_stages + 1)

															# Bit's feature maps are of shape (batch_size, num_channels, height, width)
															self.assertListEqual(
															    list(hidden_states[0].shape[-2:])   ,						[self.model_tester.image_size // 4, self.model_tester.image_size // 4]   ,						)

									SCREAMING_SNAKE_CASE_		,    SCREAMING_SNAKE_CASE_: Optional[int]  		=       self.model_tester.prepare_config_and_inputs_for_common()
									SCREAMING_SNAKE_CASE_: Union[str, Any]  		=       ["preactivation", "bottleneck"]
									for model_class in self.all_model_classes:
															for layer_type in layers_type:
																					SCREAMING_SNAKE_CASE_: Optional[Any]  		=       layer_type
																					SCREAMING_SNAKE_CASE_: Optional[Any]  		=       True
																					check_hidden_states_output(lowerCAmelCase__   ,						lowerCAmelCase__   ,						lowerCAmelCase__)

																					# check that output_hidden_states also work using config
																					del inputs_dict["output_hidden_states"]
																					SCREAMING_SNAKE_CASE_: Tuple  		=       True

																					check_hidden_states_output(lowerCAmelCase__   ,						lowerCAmelCase__   ,						lowerCAmelCase__)



			@unittest.skip(reason="Bit does not use feedforward chunking")
			def        _SCREAMING_SNAKE_CASE			( self  :     str):
									pass



			def        _SCREAMING_SNAKE_CASE			( self  :     List[Any]):
									SCREAMING_SNAKE_CASE_: Optional[int]  		=       self.model_tester.prepare_config_and_inputs()
									self.model_tester.create_and_check_for_image_classification(*lowerCAmelCase__)




			@slow
			def        _SCREAMING_SNAKE_CASE			( self  :     Any):
									for model_name in BIT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
															SCREAMING_SNAKE_CASE_: List[Any]  		=       BitModel.from_pretrained(lowerCAmelCase__)
															self.assertIsNotNone(lowerCAmelCase__)







def 			A_      (    ):
						SCREAMING_SNAKE_CASE_: List[str]  		=       Image.open("./tests/fixtures/tests_samples/COCO/000000039769.png"    )
						return image



@require_torch
@require_vision
class   __lowercase				( unittest.TestCase	):




			"""simple docstring"""







			@cached_property
			def        _SCREAMING_SNAKE_CASE			( self  :     Optional[Any]):
									return (
									    BitImageProcessor.from_pretrained(BIT_PRETRAINED_MODEL_ARCHIVE_LIST[0]) if is_vision_available() else None
									)




			@slow
			def        _SCREAMING_SNAKE_CASE			( self  :     Any):
									SCREAMING_SNAKE_CASE_: List[str]  		=       BitForImageClassification.from_pretrained(BIT_PRETRAINED_MODEL_ARCHIVE_LIST[0]).to(lowerCAmelCase__)

									SCREAMING_SNAKE_CASE_: List[str]  		=       self.default_image_processor
									SCREAMING_SNAKE_CASE_: Optional[int]  		=       prepare_img()
									SCREAMING_SNAKE_CASE_: List[Any]  		=       image_processor(images=lowerCAmelCase__   ,						return_tensors="pt").to(lowerCAmelCase__)

									# forward pass
									with torch.no_grad():
															SCREAMING_SNAKE_CASE_: int  		=       model(**lowerCAmelCase__)

									# verify the logits
									SCREAMING_SNAKE_CASE_: int  		=       torch.Size((1, 1000))
									self.assertEqual(outputs.logits.shape   ,						lowerCAmelCase__)

									SCREAMING_SNAKE_CASE_: List[str]  		=       torch.tensor([[-0.6526, -0.5263, -1.4398]]).to(lowerCAmelCase__)

									self.assertTrue(torch.allclose(outputs.logits[0, :3]   ,						lowerCAmelCase__   ,						atol=1E-4))







@require_torch
class   __lowercase				( UpperCAmelCase_		,       unittest.TestCase	):




			"""simple docstring"""







			_UpperCAmelCase   :							int										=     (BitBackbone,) if is_torch_available() else ()
			_UpperCAmelCase   :							List[str]										=     BitConfig

			_UpperCAmelCase   :							str										=     False



			def        _SCREAMING_SNAKE_CASE			( self  :     List[str]):
									SCREAMING_SNAKE_CASE_: Union[str, Any]  		=       BitModelTester(self)









class   __lowercase				:




			"""simple docstring"""







			def __init__( self  :     List[Any]   ,						lowerCAmelCase__  :     Optional[int]   ,						lowerCAmelCase__  :     List[Any]):
									SCREAMING_SNAKE_CASE_: List[str]  		=       name
									SCREAMING_SNAKE_CASE_: Union[str, Any]  		=       val



			def __str__( self  :     Dict):
									return F"{self.__class__.__name__}({self.name}, {self.val})"




			def __lt__( self  :     List[str]   ,						lowerCAmelCase__  :     Any):
									return self.val < other.val







class   __lowercase				:




			"""simple docstring"""







			def __init__( self  :     Tuple   ,						lowerCAmelCase__  :     Dict):
									SCREAMING_SNAKE_CASE_: str  		=       {}
									SCREAMING_SNAKE_CASE_: int  		=       {}
									SCREAMING_SNAKE_CASE_: Any  		=       self.build_heap(lowerCAmelCase__)



			def __getitem__( self  :     List[Any]   ,						lowerCAmelCase__  :     Dict):
									return self.get_value(lowerCAmelCase__)



			def        _SCREAMING_SNAKE_CASE			( self  :     Optional[Any]   ,						lowerCAmelCase__  :     Dict):
									return (idx - 1) // 2



			def        _SCREAMING_SNAKE_CASE			( self  :     Union[str, Any]   ,						lowerCAmelCase__  :     Optional[Any]):
									return idx * 2 + 1



			def        _SCREAMING_SNAKE_CASE			( self  :     Optional[int]   ,						lowerCAmelCase__  :     Tuple):
									return idx * 2 + 2



			def        _SCREAMING_SNAKE_CASE			( self  :     Optional[int]   ,						lowerCAmelCase__  :     Optional[int]):
									return self.heap_dict[key]



			def        _SCREAMING_SNAKE_CASE			( self  :     List[Any]   ,						lowerCAmelCase__  :     Union[str, Any]):
									SCREAMING_SNAKE_CASE_: Tuple  		=       len(lowerCAmelCase__) - 1
									SCREAMING_SNAKE_CASE_: List[str]  		=       self.get_parent_idx(lowerCAmelCase__)

									for idx, i in enumerate(lowerCAmelCase__):
															SCREAMING_SNAKE_CASE_: Union[str, Any]  		=       idx
															SCREAMING_SNAKE_CASE_: str  		=       i.val

									for i in range(lowerCAmelCase__   ,						-1   ,						-1):
															self.sift_down(lowerCAmelCase__   ,						lowerCAmelCase__)
									return array



			def        _SCREAMING_SNAKE_CASE			( self  :     str   ,						lowerCAmelCase__  :     Optional[int]   ,						lowerCAmelCase__  :     List[str]):
									while True:
															SCREAMING_SNAKE_CASE_: Optional[Any]  		=       self.get_left_child_idx(lowerCAmelCase__)  # noqa: E741
															SCREAMING_SNAKE_CASE_: Dict  		=       self.get_right_child_idx(lowerCAmelCase__)

															SCREAMING_SNAKE_CASE_: int  		=       idx
															if l < len(lowerCAmelCase__) and array[l] < array[idx]:
																					SCREAMING_SNAKE_CASE_: List[str]  		=       l
															if r < len(lowerCAmelCase__) and array[r] < array[smallest]:
																					SCREAMING_SNAKE_CASE_: str  		=       r

															if smallest != idx:
																					SCREAMING_SNAKE_CASE_		,    SCREAMING_SNAKE_CASE_: Any  		=       array[smallest], array[idx]
																					(
																					    (
																					    SCREAMING_SNAKE_CASE_
																					)		,    (
																					    SCREAMING_SNAKE_CASE_
																					)		,    
																					): Optional[Any]  		=       (
																					    self.idx_of_element[array[smallest]],
																					    self.idx_of_element[array[idx]],
																					)
																					SCREAMING_SNAKE_CASE_: Optional[int]  		=       smallest
															else:
																					break



			def        _SCREAMING_SNAKE_CASE			( self  :     Dict   ,						lowerCAmelCase__  :     str):
									SCREAMING_SNAKE_CASE_: Any  		=       self.get_parent_idx(lowerCAmelCase__)
									while p >= 0 and self.heap[p] > self.heap[idx]:
															SCREAMING_SNAKE_CASE_		,    SCREAMING_SNAKE_CASE_: List[Any]  		=       self.heap[idx], self.heap[p]
															SCREAMING_SNAKE_CASE_		,    SCREAMING_SNAKE_CASE_: Tuple  		=       (
															    self.idx_of_element[self.heap[idx]],
															    self.idx_of_element[self.heap[p]],
															)
															SCREAMING_SNAKE_CASE_: Union[str, Any]  		=       p
															SCREAMING_SNAKE_CASE_: Optional[int]  		=       self.get_parent_idx(lowerCAmelCase__)



			def        _SCREAMING_SNAKE_CASE			( self  :     List[Any]):
									return self.heap[0]



			def        _SCREAMING_SNAKE_CASE			( self  :     Dict):
									SCREAMING_SNAKE_CASE_		,    SCREAMING_SNAKE_CASE_: Tuple  		=       self.heap[-1], self.heap[0]
									SCREAMING_SNAKE_CASE_		,    SCREAMING_SNAKE_CASE_: List[str]  		=       (
									    self.idx_of_element[self.heap[-1]],
									    self.idx_of_element[self.heap[0]],
									)

									SCREAMING_SNAKE_CASE_: int  		=       self.heap.pop()
									del self.idx_of_element[x]
									self.sift_down(0   ,						self.heap)
									return x



			def        _SCREAMING_SNAKE_CASE			( self  :     Union[str, Any]   ,						lowerCAmelCase__  :     Tuple):
									self.heap.append(lowerCAmelCase__)
									SCREAMING_SNAKE_CASE_: List[str]  		=       len(self.heap) - 1
									SCREAMING_SNAKE_CASE_: List[str]  		=       node.val
									self.sift_up(len(self.heap) - 1)



			def        _SCREAMING_SNAKE_CASE			( self  :     List[Any]):
									return len(self.heap) == 0




			def        _SCREAMING_SNAKE_CASE			( self  :     Optional[Any]   ,						lowerCAmelCase__  :     Any   ,						lowerCAmelCase__  :     Optional[int]):
									assert (
									    self.heap[self.idx_of_element[node]].val > new_value
									), "newValue must be less that current value"
									SCREAMING_SNAKE_CASE_: Any  		=       new_value
									SCREAMING_SNAKE_CASE_: Tuple  		=       new_value
									self.sift_up(self.idx_of_element[node])







lowerCAmelCase							:  int   	=						Node("""R""", -1)
lowerCAmelCase							:  str   	=						Node("""B""", 6)
lowerCAmelCase							:  str   	=						Node("""A""", 3)
lowerCAmelCase							:  List[str]   	=						Node("""X""", 1)
lowerCAmelCase							:  Union[str, Any]   	=						Node("""E""", 4)

# Use one of these two ways to generate Min-Heap

# Generating Min-Heap from array
lowerCAmelCase							:  Optional[Any]   	=						MinHeap([r, b, a, x, e])

# Generating Min-Heap by Insert method
# myMinHeap.insert(a)
# myMinHeap.insert(b)
# myMinHeap.insert(x)
# myMinHeap.insert(r)
# myMinHeap.insert(e)

# Before
print("""Min Heap - before decrease key""")
for i in my_min_heap.heap:
						print(i)

print("""Min Heap - After decrease key of node [B -> -17]""")
my_min_heap.decrease_key(b, -17)

# After
for i in my_min_heap.heap:
						print(i)

if __name__ == "__main__":
						import doctest

						doctest.testmod()






