def __init__(self, default_repo, repos, name=None, **kwargs): super(PublishConfiguration, self).__init__(name=name, default_repo=addressable(Exactly(Configuration), default_repo), repos=addressable_mapping(Exactly(Configuration), repos), **kwargs)
def test_mixed(self): self.assertEqual( dict(meaning_of_life=42, fine_structure_constant=Addressed(SubclassesOf((int, float)), '//:fsc')), addressable_mapping( SubclassesOf((int, float)), dict(meaning_of_life=42, fine_structure_constant='//:fsc')))
def test_pointers(self): self.assertEqual(dict(meaning_of_life=Addressed(Exactly(int), '//:meaning-of-life')), addressable_mapping(Exactly(int), dict(meaning_of_life='//:meaning-of-life')))
def test_values(self): self.assertEqual(dict(meaning_of_life=42, fine_structure_constant=1 / 137.0), addressable_mapping(SubclassesOf((int, float)), dict(meaning_of_life=42, fine_structure_constant=1 / 137.0)))
def test_none(self): self.assertEqual({}, addressable_mapping(Exactly(int), None))
def test_type_mismatch(self): with self.assertRaises(AddressedError): addressable_mapping(Exactly(int), dict(meaning_of_life=42, fine_structure_constant=1 / 137.0))
def test_mixed(self): self.assertEqual(dict(meaning_of_life=42, fine_structure_constant=Addressed(SubclassesOf((int, float)), '//:fsc')), addressable_mapping(SubclassesOf((int, float)), dict(meaning_of_life=42, fine_structure_constant='//:fsc')))
def test_values(self): self.assertEqual( dict(meaning_of_life=42, fine_structure_constant=1 / 137.0), addressable_mapping( SubclassesOf((int, float)), dict(meaning_of_life=42, fine_structure_constant=1 / 137.0)))
def test_type_mismatch(self): with self.assertRaises(AddressedError): addressable_mapping( Exactly(int), dict(meaning_of_life=42, fine_structure_constant=1 / 137.0))
def test_pointers(self): self.assertEqual( dict( meaning_of_life=Addressed(Exactly(int), '//:meaning-of-life')), addressable_mapping(Exactly(int), dict(meaning_of_life='//:meaning-of-life')))