def testBadArgs(self):
    self.assertRaises(TypeError, BZ2File, 123.456)
    self.assertRaises(ValueError, BZ2File, os.devnull, 'z')
    self.assertRaises(ValueError, BZ2File, os.devnull, 'rx')
    self.assertRaises(ValueError, BZ2File, os.devnull, 'rbt')
    self.assertRaises(ValueError, BZ2File, os.devnull, compresslevel=0)
    self.assertRaises(ValueError, BZ2File, os.devnull, compresslevel=10)
    self.assertRaises(TypeError, BZ2File, os.devnull, 'r', 3)
def testBadArgs(self):
    self.assertRaises(TypeError, BZ2File, 123.456)
    self.assertRaises(ValueError, BZ2File, os.devnull, 'z')
    self.assertRaises(ValueError, BZ2File, os.devnull, 'rx')
    self.assertRaises(ValueError, BZ2File, os.devnull, 'rbt')
    self.assertRaises(ValueError, BZ2File, os.devnull, compresslevel=0)
    self.assertRaises(ValueError, BZ2File, os.devnull, compresslevel=10)
    self.assertRaises(TypeError, BZ2File, os.devnull, 'r', 3)