aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--python/gats.py12
-rwxr-xr-xpython/test.py13
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
155def _writeObj( obj, sOut ): 155def _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
3import gats 3import gats
4 4
5print gats.load( open('test.gats', 'rb') ) 5print isinstance( True, bool )
6print isinstance( True, int )
7print isinstance( 1, bool )
8print isinstance( 1, int )
6 9
7gats.dump( 3.14159, open('out.gats', 'wb') ) 10print gats.loads( gats.dumps( 0 ) )
8
9print gats.loads(
10 gats.dumps(
11 500.12345
12 )
13 )