diff options
| -rw-r--r-- | python/gats.py | 12 | ||||
| -rwxr-xr-x | python/test.py | 13 |
2 files changed, 11 insertions, 14 deletions
diff --git a/python/gats.py b/python/gats.py index 760314a..40139a2 100644 --- a/python/gats.py +++ b/python/gats.py | |||
| @@ -153,7 +153,12 @@ def _readObj( sIn ): | |||
| 153 | return 'not implemented yet'; | 153 | return 'not implemented yet'; |
| 154 | 154 | ||
| 155 | def _writeObj( obj, sOut ): | 155 | def _writeObj( obj, sOut ): |
| 156 | if isinstance( obj, int ): | 156 | if isinstance( obj, bool ): |
| 157 | if obj == True: | ||
| 158 | sOut.write('1') | ||
| 159 | else: | ||
| 160 | sOut.write('0') | ||
| 161 | elif isinstance( obj, int ): | ||
| 157 | sOut.write('i') | 162 | sOut.write('i') |
| 158 | _writePackedInt( obj, sOut ) | 163 | _writePackedInt( obj, sOut ) |
| 159 | elif isinstance( obj, str ): | 164 | elif isinstance( obj, str ): |
| @@ -171,11 +176,6 @@ def _writeObj( obj, sOut ): | |||
| 171 | _writeObj( key, sOut ) | 176 | _writeObj( key, sOut ) |
| 172 | _writeObj( obj[key], sOut ) | 177 | _writeObj( obj[key], sOut ) |
| 173 | sOut.write('e') | 178 | sOut.write('e') |
| 174 | elif isinstance( obj, bool ): | ||
| 175 | if obj == True: | ||
| 176 | sOut.write('1') | ||
| 177 | else: | ||
| 178 | sOut.write('0') | ||
| 179 | elif isinstance( obj, float ): | 179 | elif isinstance( obj, float ): |
| 180 | if math.isnan( obj ): | 180 | if math.isnan( obj ): |
| 181 | if math.copysign( 1.0, obj ) < 0.0: | 181 | if math.copysign( 1.0, obj ) < 0.0: |
diff --git a/python/test.py b/python/test.py index f4e679a..fa9c79a 100755 --- a/python/test.py +++ b/python/test.py | |||
| @@ -2,12 +2,9 @@ | |||
| 2 | 2 | ||
| 3 | import gats | 3 | import gats |
| 4 | 4 | ||
| 5 | print gats.load( open('test.gats', 'rb') ) | 5 | print isinstance( True, bool ) |
| 6 | print isinstance( True, int ) | ||
| 7 | print isinstance( 1, bool ) | ||
| 8 | print isinstance( 1, int ) | ||
| 6 | 9 | ||
| 7 | gats.dump( 3.14159, open('out.gats', 'wb') ) | 10 | print gats.loads( gats.dumps( 0 ) ) |
| 8 | |||
| 9 | print gats.loads( | ||
| 10 | gats.dumps( | ||
| 11 | 500.12345 | ||
| 12 | ) | ||
| 13 | ) | ||
