Пример #1
0
def test():
    from r2.lib.mr_tools._mr_tools import keyiter

    for key, vals in keyiter():
        print key, vals
        for val in vals:
            print "\t", val
Пример #2
0
def test():
    from r2.lib.mr_tools._mr_tools import keyiter

    for key, vals in keyiter():
        print key, vals
        for val in vals:
            print '\t', val
Пример #3
0
 def test_keyiter(self):
     stdin = StringIO("\n".join([
         "foo\tbar\tbar1",
         "baz\tbad\tbad1",
     ]))
     d = {k: list(v) for k, v in keyiter(stream=stdin)}
     self.assertEqual(d, {
         "foo": [["bar", "bar1"]],
         "baz": [["bad", "bad1"]],
     })
Пример #4
0
 def test_keyiter(self):
     stdin = StringIO("\n".join(["foo\tbar\tbar1", "baz\tbad\tbad1"]))
     d = {k: list(v) for k, v in keyiter(stream=stdin)}
     self.assertEqual(d, {"foo": [["bar", "bar1"]], "baz": [["bad", "bad1"]]})