def test_cast_truish_to_boolean(self): self.assertEqual( cast_to_boolean(-1, IntegerType(), options=BASE_OPTIONS), True)
def test_cast_falsish_to_boolean(self): self.assertEqual( cast_to_boolean(0, IntegerType(), options=BASE_OPTIONS), False)
def test_cast_empty_string_to_boolean(self): self.assertEqual( cast_to_boolean("", StringType(), options=BASE_OPTIONS), None)
def test_cast_random_string_to_boolean(self): self.assertEqual( cast_to_boolean("pysparkling", StringType(), options=BASE_OPTIONS), None)
def test_cast_false_to_boolean(self): self.assertEqual( cast_to_boolean("FalsE", StringType(), options=BASE_OPTIONS), False)
def test_cast_true_to_boolean(self): self.assertEqual( cast_to_boolean("TrUe", StringType(), options=BASE_OPTIONS), True)