def test_is_bin_str(self): self.assertFalse(utils.is_bin_str(LORUM_IPSUM)) zero_str = '{0}{1}'.format(LORUM_IPSUM, '\0') self.assertTrue(utils.is_bin_str(zero_str)) # To to ensure safe exit if str passed doesn't evaluate to True self.assertFalse(utils.is_bin_str(''))
def test_is_bin_str(self): self.assertFalse(utils.is_bin_str(LORUM_IPSUM)) zero_str = '{0}{1}'.format(LORUM_IPSUM, '\0') self.assertTrue(utils.is_bin_str(zero_str)) # To to ensure safe exit if str passed doesn't evaluate to True self.assertFalse(utils.is_bin_str('')) nontext = 3 * (''.join([chr(x) for x in range(1, 32) if x not in (8, 9, 10, 12, 13)])) almost_bin_str = '{0}{1}'.format(LORUM_IPSUM[:100], nontext[:42]) self.assertFalse(utils.is_bin_str(almost_bin_str)) bin_str = almost_bin_str + '\x01' self.assertTrue(utils.is_bin_str(bin_str))