Fix config.py output when a symbol has acquired or lost a value

Normally a valueless symbol remains valueless and a symbol with a
value keeps having one. But just in case a symbol does get changed
from valueless to having a value, make sure there's a space between
the symbol and the value. And if a symbol gets changed from having a
value to valueless, strip trailing whitespace.

Add corresponding tests.

Also fix the case of a valueless symbol added with the set method,
which would have resulted in attempting to use None as a string. This
only happened with the Python API, not with the command line API.
diff --git a/tests/scripts/test_config_script.py b/tests/scripts/test_config_script.py
index a71b357..dd3ecbb 100755
--- a/tests/scripts/test_config_script.py
+++ b/tests/scripts/test_config_script.py
@@ -129,6 +129,7 @@
 TEST_SYMBOLS = [
     'CUSTOM_OPTION',
     'MBEDTLS_AES_C',
+    'MBEDTLS_MPI_MAX_SIZE',
     'MBEDTLS_NO_UDBL_DIVISION',
     'MBEDTLS_PLATFORM_ZEROIZE_ALT',
 ]
@@ -136,6 +137,7 @@
 ### A list of symbols to test with set with a value.
 TEST_SYMBOLS_WITH_VALUE = [
     'CUSTOM_VALUE',
+    'MBEDTLS_AES_C',
     'MBEDTLS_MPI_MAX_SIZE',
 ]
 
@@ -151,6 +153,7 @@
     for symbol in TEST_SYMBOLS_WITH_VALUE:
         run_one(options, ['set', symbol, 'value'])
         run_one(options, ['--force', 'set', symbol, 'value'])
+        run_one(options, ['unset', symbol])
 
 def main():
     """Command line entry point."""