Permalink
Browse files

added long/uint64 type for pmt_to/from_python

  • Loading branch information...
1 parent 075bf6e commit c417d802d93b4215d32a95c5f3d0f8d68b57aedb @guruofquality committed Sep 6, 2012
Showing with 8 additions and 0 deletions.
  1. +1 −0 python/pmt_to_python.py
  2. +7 −0 python/qa_pmt_to_python.py
View
@@ -79,6 +79,7 @@ def numpy_to_blob(p):
(bool, pmt.pmt_is_bool, pmt.pmt_to_bool, pmt.pmt_from_bool),
(str, pmt.pmt_is_symbol, pmt.pmt_symbol_to_string, pmt.pmt_string_to_symbol),
(int, pmt.pmt_is_integer, pmt.pmt_to_long, pmt.pmt_from_long),
+ (long, pmt.pmt_is_uint64, lambda x: long(pmt.pmt_to_uint64(x)), pmt.pmt_from_uint64),
(float, pmt.pmt_is_real, pmt.pmt_to_double, pmt.pmt_from_double),
(complex, pmt.pmt_is_complex, pmt.pmt_to_complex, pmt_from_complex),
(tuple, pmt.pmt_is_tuple, pmt_to_tuple, pmt_from_tuple),
@@ -65,6 +65,13 @@ def test_iterables(self):
def test_nested(self):
self.loopback([(1, "two"), {3 : 4.0}, [5, (6j, )]])
+ self.loopback({'channel': 123, 'timestamp': (100L, 0.2)})
+
+ def test_time_tuple(self):
+ timestamp = pmt.pmt_make_tuple(pmt.pmt_from_uint64(123), pmt.pmt_from_double(0.123))
+ ts = pmt.to_python(timestamp)
+ self.assertTrue(isinstance(ts[0], long));
+ self.assertTrue(isinstance(ts[1], float));
def test_numpy(self):
python_data = numpy.array([1, 2, 3], numpy.uint8)

0 comments on commit c417d80

Please sign in to comment.