예제 #1
0
 def test_merge_bson_unique_merge_bson(self):
     self.setUp()
     args = merge_bson.parse_args(['-i', os.path.dirname(os.path.abspath(__file__))+'/../test/test.bson',  os.path.dirname(os.path.abspath(__file__))+'/../test/test.bson', '-o', os.path.dirname(os.path.abspath(__file__))+'/../test/output.bson', '-f', '_id'])
     merge_bson.merge_bson_unique(args.output, args.inputs, args.uniquefield)
     #ouput should be the same size as one input since the merge merges the same file with same object ids 2x.
     self.assertEqual(os.path.getsize(os.path.dirname(os.path.abspath(__file__))+'/../test/test.bson'), os.path.getsize(os.path.dirname(os.path.abspath(__file__))+'/../test/output.bson'))
     #delete output.bson when test is done
     self.tearDown()
예제 #2
0
 def test_merge_bson_merge_bson(self):
     self.setUp()
     args = merge_bson.parse_args(['-i', os.path.dirname(os.path.abspath(__file__))+'/../test/test.bson',  os.path.dirname(os.path.abspath(__file__))+'/../test/test.bson', '-o', os.path.dirname(os.path.abspath(__file__))+'/../test/output.bson'])
     merge_bson.merge_bson(args.output, args.inputs)
     #the output file should have 2x the size of the input file because standard merge
     self.assertEqual(2 * os.path.getsize(os.path.dirname(os.path.abspath(__file__))+'/../test/test.bson'),os.path.getsize(os.path.dirname(os.path.abspath(__file__))+'/../test/output.bson'))
     #delete output.bson when test is done
     self.tearDown()
예제 #3
0
 def test_merge_bson_merge_bson(self):
     self.setUp()
     args = merge_bson.parse_args([
         '-i',
         os.path.dirname(os.path.abspath(__file__)) + '/../test/test.bson',
         os.path.dirname(os.path.abspath(__file__)) + '/../test/test.bson',
         '-o',
         os.path.dirname(os.path.abspath(__file__)) + '/../test/output.bson'
     ])
     merge_bson.merge_bson(args.output, args.inputs)
     #the output file should have 2x the size of the input file because standard merge
     self.assertEqual(
         2 * os.path.getsize(
             os.path.dirname(os.path.abspath(__file__)) +
             '/../test/test.bson'),
         os.path.getsize(
             os.path.dirname(os.path.abspath(__file__)) +
             '/../test/output.bson'))
     #delete output.bson when test is done
     self.tearDown()
예제 #4
0
 def test_merge_bson_unique_merge_bson(self):
     self.setUp()
     args = merge_bson.parse_args([
         '-i',
         os.path.dirname(os.path.abspath(__file__)) + '/../test/test.bson',
         os.path.dirname(os.path.abspath(__file__)) + '/../test/test.bson',
         '-o',
         os.path.dirname(os.path.abspath(__file__)) +
         '/../test/output.bson', '-f', '_id'
     ])
     merge_bson.merge_bson_unique(args.output, args.inputs,
                                  args.uniquefield)
     #ouput should be the same size as one input since the merge merges the same file with same object ids 2x.
     self.assertEqual(
         os.path.getsize(
             os.path.dirname(os.path.abspath(__file__)) +
             '/../test/test.bson'),
         os.path.getsize(
             os.path.dirname(os.path.abspath(__file__)) +
             '/../test/output.bson'))
     #delete output.bson when test is done
     self.tearDown()
예제 #5
0
 def test_merge_bson_parse_args(self):
     args = merge_bson.parse_args(
         ['-i', '~/data1.bson', '~/data2.bson', '-o', '~/data3.bson'])
     self.assertEqual(set(args.inputs),
                      set(['~/data1.bson', '~/data2.bson']))
     self.assertEqual(args.output, '~/data3.bson')
예제 #6
0
 def test_merge_bson_parse_args(self):
     args = merge_bson.parse_args(['-i', '~/data1.bson', '~/data2.bson', '-o', '~/data3.bson'])
     self.assertEqual(set(args.inputs),set(['~/data1.bson', '~/data2.bson']))
     self.assertEqual(args.output,'~/data3.bson')