'pytest assert called with when having multiple inputs

I'm calling the write method of this spark dataframe

        df.write.format('snowflake') \
            .options(**self._get_options()) \
            .option('dbTable', target_table) \
            .option('sfDatabase', target_database if target_database else self.database) \
            .option('sfSchema', target_schema if target_schema else self.schema) \
            .mode(mode) \
            .save()

I want in my test to assert that it was called with these values

    df_mock = mocker.MagicMock()
    df_mock.write.format('snowflake') \
        .options(**instance.__dict__) \
        .option("dbTable", target_table) \
        .option("sfDatabase", target_schema) \
        .option("sfSchema", target_database) \
        .mode("overwrite").save.assert_called_with()

However, it seems that even if I put completely random values it works as it is not testing the values it was called with but the just that it was called

how can I test that that piece of code has been called with those format, option and mode?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source