In the src directory (the directory that contains the sweetscomplete directory), we define a demonstration script that tests our new class. We call the script /path/to/repo/chapters/04/demo_sweetscomplete_product_entity.py. In the first few lines of code, we tell Python where to find the source code and import classes needed for the demo, as shown here:
# sweetscomplete.entity.product.Product
# tell Python where to find module source code
import os,sys
sys.path.append(os.path.realpath('src'))
import pprint
from datetime import date
from sweetscomplete.entity.product import Product
Next, we define a demo key and the initial block of data in the form of a dictionary:
key = 'TEST' + date.today().isoformat().replace('-', '')
doc = dict({
'productKey' : key,
'productPhoto': 'TEST',
'skuNumber' : 'TEST0000',
'category' : 'test',
'title&apos...