def test_json_into_mongodb(empty_collec): with filetext(json.dumps(les_mis_data)) as filename: dd = JSON(filename) coll = empty_collec into(coll,dd) mongo_data = list(coll.find()) last = mongo_data[0]['nodes'][-1] first = mongo_data[0]['nodes'][0] first = (first['group'], first['name']) last = (last['group'], last['name']) assert dd.as_py()[1][-1] == last assert dd.as_py()[1][0] == first
def test_json_into_mongodb(empty_collec): with filetext(json.dumps(les_mis_data)) as filename: dd = JSON(filename) coll = empty_collec into(coll, dd) mongo_data = list(coll.find()) last = mongo_data[0]['nodes'][-1] first = mongo_data[0]['nodes'][0] first = (first['group'], first['name']) last = (last['group'], last['name']) assert dd.as_py()[1][-1] == last assert dd.as_py()[1][0] == first
def test_as_py(self): dd = JSON(self.filename, 'r', dshape=self.dshape) self.assertEqual(tuplify(dd.as_py()), self.ordered)
def test_as_py(self): dd = JSON(self.filename, 'r', dshape=self.dshape) self.assertEqual(dd.as_py(), self.data)