Skip to content

Instantly share code, notes, and snippets.

import pytest
from pytest_bdd import given, when, then, scenario, parsers, scenarios
from demo_project.transformers.user_segment import get_user_segment
import pandas as pd
@scenario(
"test_customer_segment.feature",
"Label customers as premium if they are between 19 and 60 and made high past purchases",
)
Feature: Customer Segmentation
As a retail business
In order to personalize marketing strategies
I want to segment customers based on their attributes and behavior
Scenario: Label customers as premium if they are between 19 and 60 and made high past purchases
Given a customer is <age> years old
And the customer has <income_level> income
And the customer has made high past purchases
When the segmentation process is executed
from dataclasses import dataclass
@dataclass
class BQJobProfile:
job: object
user: str
def __post_init__(self):
self.job_id = self.job["jobName"]["jobId"]
resource.type="bigquery_resource"
logName=("projects/<project_id>/logs/cloudaudit.googleapis.com%2Factivity" OR "projects/<project_id>/logs/cloudaudit.googleapis.com%2Fdata_access")
protoPayload.methodName="jobservice.jobcompleted"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.