Repository: pynamodb/PynamoDB

Issue:
Empty String/Binary values support?
DynamoDB recently supported empty values for _non-key_ String/Binary attributes.

Though PynamoDB currently supports empty value as null (None), 
does PynamoDB have any plans to support this new feature of DynamoDB?

Discussion:

Patch:
diff --git a/pynamodb/attributes.py b/pynamodb/attributes.py
index 3c0f197..36a4e8b 100644
--- a/pynamodb/attributes.py
+++ b/pynamodb/attributes.py
@@ -362,12 +362,9 @@ class BinaryAttribute(Attribute[bytes]):
 
     def deserialize(self, value):
         """
-        Returns a decoded string from base64
+        Returns a decoded byte string from a base64 encoded value
         """
-        try:
-            return b64decode(value.decode(DEFAULT_ENCODING))
-        except AttributeError:
-            return b64decode(value)
+        return b64decode(value)
 
 
 class BinarySetAttribute(SetMixin, Attribute[Set[bytes]]):
@@ -439,15 +436,6 @@ class UnicodeAttribute(Attribute[str]):
     """
     attr_type = STRING
 
-    def serialize(self, value):
-        """
-        Returns a unicode string
-        """
-        if value is None or not len(value):
-            return None
-        else:
-            return value
-
 
 class JSONAttribute(Attribute[Any]):
     """


Test patch:
diff --git a/tests/test_attributes.py b/tests/test_attributes.py
index e39527b..5eb3400 100644
--- a/tests/test_attributes.py
+++ b/tests/test_attributes.py
@@ -54,7 +54,7 @@ class CustomAttrMap(MapAttribute):
 
 class DefaultsMap(MapAttribute):
     map_field = MapAttribute(default={})
-    string_field = UnicodeAttribute(null=True)
+    string_set_field = UnicodeSetAttribute(null=True)
 
 
 class TestAttributeDescriptor:
@@ -378,7 +378,7 @@ class TestUnicodeAttribute:
         """
         attr = UnicodeAttribute()
         assert attr.serialize('foo') == 'foo'
-        assert attr.serialize('') is None
+        assert attr.serialize('') == ''
         assert attr.serialize(None) is None
 
     def test_unicode_deserialize(self):
@@ -388,6 +388,8 @@ class TestUnicodeAttribute:
         attr = UnicodeAttribute()
         assert attr.deserialize('foo') == 'foo'
         assert attr.deserialize(u'foo') == 'foo'
+        assert attr.deserialize('') == ''
+        assert attr.deserialize(None) is None
 
     def test_unicode_set_serialize(self):
         """
@@ -622,7 +624,7 @@ class TestMapAttribute:
 
     def test_null_attribute_map_after_serialization(self):
         null_attribute = {
-            'string_field': '',
+            'string_set_field': {},
         }
         attr = DefaultsMap()
         serialized = attr.serialize(null_attribute)