Example #1
0
 def test_get_key_values_stream2(self):
     stream = get_stream(STREAM_2_DATA)
     kvs_stream = get_key_values_stream(stream, private_encoding=False)
     kvs2_stream = it.groupby(STREAM_2_DATA, keyfunc)
     for (k1, vals1), (k2, itx) in it.izip(kvs_stream, kvs2_stream):
         self.assertEqual(k1, k2)
         if k1 == "key2":
             vals2 = it.imap(lambda t: t[1], it.ifilter(lambda t: t[0] == "reduceValue", itx))
             for v1, v2 in it.izip(vals1, vals2):
                 self.assertEqual(v1, v2)
Example #2
0
    def test_get_key_values_stream(self):
        stream = get_stream(STREAM_2_DATA)
        kvs_stream = get_key_values_stream(stream, private_encoding=False)
        kvs2_stream = it.groupby(STREAM_2_DATA, keyfunc)

        for (k1, vals1), (k2, itx) in it.izip(kvs_stream, kvs2_stream):
            self.assertEqual(k1, k2)
            vals2 = it.imap(lambda t: t[1],
                            it.ifilter(lambda t: t[0] == 'reduceValue', itx))
            for v1, v2 in it.izip(vals1, vals2):
                self.assertEqual(v1, v2)
Example #3
0
 def test_get_key_values_stream2(self):
     stream = get_stream(STREAM_2_DATA)
     kvs_stream = get_key_values_stream(stream, private_encoding=False)
     kvs2_stream = it.groupby(STREAM_2_DATA, keyfunc)
     for (k1, vals1), (k2, itx) in czip(kvs_stream, kvs2_stream):
         self.assertEqual(k1, k2)
         if k1 == 'key2':
             vals2 = cmap(lambda t: t[1],
                          cfilter(lambda t: t[0] == streams.REDUCE_VALUE,
                                  itx))
             for v1, v2 in czip(vals1, vals2):
                 self.assertEqual(v1, v2)