示例#1
0
 def test_pad(self):
     flag = DataQualityFlag(FLAG1, active=ACTIVE, known=KNOWN)
     # test without arguments (and no padding)
     padded = flag.pad()
     self.assertListEqual(padded.known, flag.known)
     self.assertListEqual(padded.active, flag.active)
     # test without arguments (and no padding)
     flag.padding = PADDING
     padded = flag.pad()
     self.assertListEqual(padded.known, KNOWNPAD)
     self.assertListEqual(padded.active, ACTIVEPAD)
     # test with arguments
     flag = DataQualityFlag(FLAG1, active=ACTIVE, known=KNOWN)
     padded = flag.pad(*PADDING)
     self.assertListEqual(padded.known, KNOWNPAD)
     self.assertListEqual(padded.active, ACTIVEPAD)
     # test coalesce
     padded.coalesce()
     self.assertListEqual(padded.active, ACTIVEPADC)
     # test in-place
     flag = DataQualityFlag(FLAG1, active=ACTIVE, known=KNOWN)
     padded = flag.pad(*PADDING)
     self.assertIsNot(flag, padded)
     padded = flag.pad(*PADDING, inplace=True)
     self.assertIs(flag, padded)
     # test other kwargs fail
     self.assertRaises(TypeError, flag.pad, *PADDING, kwarg='test')
示例#2
0
 def test_pad(self):
     flag = DataQualityFlag(FLAG1, active=ACTIVE, known=KNOWN)
     # test without arguments (and no padding)
     padded = flag.pad()
     self.assertListEqual(padded.known, flag.known)
     self.assertListEqual(padded.active, flag.active)
     # test without arguments (and no padding)
     flag.padding = PADDING
     padded = flag.pad()
     self.assertListEqual(padded.known, KNOWNPAD)
     self.assertListEqual(padded.active, ACTIVEPAD)
     # test with arguments
     flag = DataQualityFlag(FLAG1, active=ACTIVE, known=KNOWN)
     padded = flag.pad(*PADDING)
     self.assertListEqual(padded.known, KNOWNPAD)
     self.assertListEqual(padded.active, ACTIVEPAD)
     # test coalesce
     padded.coalesce()
     self.assertListEqual(padded.active, ACTIVEPADC)
     # test in-place
     flag = DataQualityFlag(FLAG1, active=ACTIVE, known=KNOWN)
     padded = flag.pad(*PADDING)
     self.assertIsNot(flag, padded)
     padded = flag.pad(*PADDING, inplace=True)
     self.assertIs(flag, padded)
     # test other kwargs fail
     self.assertRaises(TypeError, flag.pad, *PADDING, kwarg='test')
示例#3
0
 def test_pad(self):
     flag = DataQualityFlag(FLAG1, active=ACTIVE, known=KNOWN)
     # test without arguments (and no padding)
     padded = flag.pad()
     self.assertListEqual(padded.known, flag.known)
     self.assertListEqual(padded.active, flag.active)
     # test without arguments (and no padding)
     flag.padding = PADDING
     padded = flag.pad()
     self.assertListEqual(padded.known, KNOWNPAD)
     self.assertListEqual(padded.active, ACTIVEPAD)
     # test with arguments
     flag = DataQualityFlag(FLAG1, active=ACTIVE, known=KNOWN)
     padded = flag.pad(*PADDING)
     self.assertListEqual(padded.known, KNOWNPAD)
     self.assertListEqual(padded.active, ACTIVEPAD)
     # test coalesce
     padded.coalesce()
     self.assertListEqual(padded.active, ACTIVEPADC)
示例#4
0
 def test_pad(self):
     flag = DataQualityFlag(FLAG1, active=ACTIVE, known=KNOWN)
     # test without arguments (and no padding)
     padded = flag.pad()
     self.assertListEqual(padded.known, flag.known)
     self.assertListEqual(padded.active, flag.active)
     # test without arguments (and no padding)
     flag.padding = PADDING
     padded = flag.pad()
     self.assertListEqual(padded.known, KNOWNPAD)
     self.assertListEqual(padded.active, ACTIVEPAD)
     # test with arguments
     flag = DataQualityFlag(FLAG1, active=ACTIVE, known=KNOWN)
     padded = flag.pad(*PADDING)
     self.assertListEqual(padded.known, KNOWNPAD)
     self.assertListEqual(padded.active, ACTIVEPAD)
     # test coalesce
     padded.coalesce()
     self.assertListEqual(padded.active, ACTIVEPADC)