style: apply black and isort formatting across entire codebase

- Standardize quote style (single to double quotes)
- Reorder and group imports alphabetically
- Fix line breaks and indentation for consistency
- Apply PEP 8 formatting standards

Also updated Makefile to exclude both venv and .venv from code quality checks.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-28 19:30:17 +01:00
parent 13f0094743
commit 21c13ca39b
236 changed files with 8450 additions and 6545 deletions

View File

@@ -2,8 +2,8 @@
import pytest
from app.services.stats_service import StatsService
from models.database.marketplace_product import MarketplaceProduct
from models.database.inventory import Inventory
from models.database.marketplace_product import MarketplaceProduct
@pytest.mark.unit
@@ -15,7 +15,9 @@ class TestStatsService:
"""Setup method following the same pattern as other service tests"""
self.service = StatsService()
def test_get_comprehensive_stats_basic(self, db, test_marketplace_product, test_inventory):
def test_get_comprehensive_stats_basic(
self, db, test_marketplace_product, test_inventory
):
"""Test getting comprehensive stats with basic data"""
stats = self.service.get_comprehensive_stats(db)
@@ -31,7 +33,9 @@ class TestStatsService:
assert stats["total_inventory_entries"] >= 1
assert stats["total_inventory_quantity"] >= 10 # test_inventory has quantity 10
def test_get_comprehensive_stats_multiple_products(self, db, test_marketplace_product):
def test_get_comprehensive_stats_multiple_products(
self, db, test_marketplace_product
):
"""Test comprehensive stats with multiple products across different dimensions"""
# Create products with different brands, categories, marketplaces
additional_products = [
@@ -87,7 +91,7 @@ class TestStatsService:
brand=None, # Null brand
google_product_category=None, # Null category
marketplace=None, # Null marketplace
vendor_name=None, # Null vendor
vendor_name=None, # Null vendor
price="10.00",
currency="EUR",
),
@@ -97,7 +101,7 @@ class TestStatsService:
brand="", # Empty brand
google_product_category="", # Empty category
marketplace="", # Empty marketplace
vendor_name="", # Empty vendor
vendor_name="", # Empty vendor
price="15.00",
currency="EUR",
),
@@ -124,7 +128,11 @@ class TestStatsService:
# Find our test marketplace in the results
test_marketplace_stat = next(
(stat for stat in stats if stat["marketplace"] == test_marketplace_product.marketplace),
(
stat
for stat in stats
if stat["marketplace"] == test_marketplace_product.marketplace
),
None,
)
assert test_marketplace_stat is not None
@@ -309,7 +317,9 @@ class TestStatsService:
count = self.service._get_unique_marketplaces_count(db)
assert count >= 2 # At least Amazon and eBay, plus test_marketplace_product marketplace
assert (
count >= 2
) # At least Amazon and eBay, plus test_marketplace_product marketplace
assert isinstance(count, int)
def test_get_unique_vendors_count(self, db, test_marketplace_product):
@@ -338,7 +348,9 @@ class TestStatsService:
count = self.service._get_unique_vendors_count(db)
assert count >= 2 # At least VendorA and VendorB, plus test_marketplace_product vendor
assert (
count >= 2
) # At least VendorA and VendorB, plus test_marketplace_product vendor
assert isinstance(count, int)
def test_get_inventory_statistics(self, db, test_inventory):
@@ -438,7 +450,7 @@ class TestStatsService:
db.add_all(marketplace_products)
db.commit()
vendors =self.service._get_vendors_by_marketplace(db, "TestMarketplace")
vendors = self.service._get_vendors_by_marketplace(db, "TestMarketplace")
assert len(vendors) == 2
assert "TestVendor1" in vendors
@@ -482,7 +494,9 @@ class TestStatsService:
def test_get_products_by_marketplace_not_found(self, db):
"""Test getting product count for non-existent marketplace"""
count = self.service._get_products_by_marketplace_count(db, "NonExistentMarketplace")
count = self.service._get_products_by_marketplace_count(
db, "NonExistentMarketplace"
)
assert count == 0