def test_non_dict_items(self): class NonDictItems(object): def items(self): yield (u"e", u"f") yield (u"g", u"h") self.assertEqual(_environment_to_string(NonDictItems()), u"e=f\0g=h\0\0")
def test_non_dict_iteritems(self): class NonDictIterItems(object): def iteritems(self): yield (u"a", u"b") yield (u"c", u"d") self.assertEqual(_environment_to_string(NonDictIterItems()), u"a=b\0c=d\0\0")
def test_non_dict_items(self): class NonDictItems(object): def items(self): yield (u"e", u"f") yield (u"g", u"h") self.assertEqual( _environment_to_string(NonDictItems()), u"e=f\0g=h\0\0")
def test_non_dict_iteritems(self): class NonDictIterItems(object): def iteritems(self): yield (u"a", u"b") yield (u"c", u"d") self.assertEqual( _environment_to_string(NonDictIterItems()), u"a=b\0c=d\0\0")
def test_not_a_dictionary(self): expected = "Expected a dictionary like object for `environment`" with self.assertRaisesRegex(InputError, expected): _environment_to_string(None)
def test_key_cannot_contain_equals(self): with self.assertRaisesRegex(InputError, ".*cannot contain the `=`.*"): _environment_to_string({text_type("3=4"): text_type("")})
def test_type_check_for_environment_value(self): with self.assertRaisesRegex(InputError, ".*environment value 2.*"): _environment_to_string({text_type("1"): 2})
def test_type_check_for_environment_key(self): with self.assertRaises(InputError): _environment_to_string({1: text_type("")})
def test_not_a_dictionary(self): expected = "Expected a dictionary like object for `environment`" with self.assertRaisesRegex(InputError, expected): _environment_to_string(None)
def test_key_cannot_contain_equals(self): with self.assertRaisesRegex(InputError, ".*cannot contain the `=`.*"): _environment_to_string({u"3=4": u""})
def test_type_check_for_environment_value(self): with self.assertRaisesRegex(InputError, ".*environment value 2.*"): _environment_to_string({u"1": 2})
def test_type_check_for_environment_key(self): with self.assertRaises(InputError): _environment_to_string({1: u""})