def test_other_disallowed(self): instance = create_instance(String()) with self.assertRaises(TypeError): instance.attr = tuple()
def test_unicode_allowed(self): instance = create_instance(String()) instance.attr = u'abc' self.assertEqual(u'abc', instance.attr)
def test_empty_string(self): instance = create_instance(String()) instance.attr = '' self.assertEqual('', instance.attr)
def test_native_str_allowed(self): instance = create_instance(String()) instance.attr = str('abc') self.assertEqual('abc', instance.attr)
def test_bytes_allowed(self): instance = create_instance(String()) instance.attr = b'abc' self.assertEqual(b'abc', instance.attr)
def test_default_handling(self): instance = create_instance(String(default='abc')) self.assertEqual('abc', instance.attr)
def test_empty_string(self): instance = create_instance(String()) instance.attr = "" assert "" == instance.attr
def test_unicode_allowed(self): instance = create_instance(String()) instance.attr = "abc" assert "abc" == instance.attr
def test_native_str_allowed(self): instance = create_instance(String()) instance.attr = "abc" assert "abc" == instance.attr
def test_default_handling(self): instance = create_instance(String(default="abc")) assert "abc" == instance.attr