Example #1
0
 def test_validate_absence_of_columns_when_column_is_present(self):
     data = [("jose", 1), ("li", 2), ("luisa", 3)]
     source_df = spark.createDataFrame(data, ["name", "age"])
     with pytest.raises(quinn.DataFrameProhibitedColumnError) as excinfo:
         quinn.validate_absence_of_columns(source_df, ["age", "cool"])
     assert excinfo.value.args[
         0] == "The ['age'] columns are not allowed to be included in the DataFrame with the following columns ['name', 'age']"
Example #2
0
 def it_does_nothing_when_no_unallowed_columns_are_present(spark):
     data = [("jose", 1), ("li", 2), ("luisa", 3)]
     source_df = spark.createDataFrame(data, ["name", "age"])
     quinn.validate_absence_of_columns(source_df, ["favorite_color"])
Example #3
0
 def test_validate_absence_of_columns_when_column_isnt_present(self):
     data = [("jose", 1), ("li", 2), ("luisa", 3)]
     source_df = spark.createDataFrame(data, ["name", "age"])
     quinn.validate_absence_of_columns(source_df, ["favorite_color"])