From 564cf0a1e6766a2bb1e15e008d8350ddfa7014ed Mon Sep 17 00:00:00 2001 From: Fred Z Date: Thu, 2 Aug 2018 11:41:58 +0200 Subject: [PATCH] Moves sample files in dedicated directory --- function.py | 10 +++++----- .../category-biscuits.json | 0 .../product-3017760000109.json | 0 .../product-8410000810004.json | 0 4 files changed, 5 insertions(+), 5 deletions(-) rename sample-category-biscuits.json => sample/category-biscuits.json (100%) rename sample-product-3017760000109.json => sample/product-3017760000109.json (100%) rename sample-product-8410000810004.json => sample/product-8410000810004.json (100%) diff --git a/function.py b/function.py index bb52349..6adc8c1 100644 --- a/function.py +++ b/function.py @@ -34,10 +34,10 @@ def get_product(code, from_file=False): >>> prod_beurre = get_product('3017760000109', True) >>> prod_oreo = get_product('8410000810004', True) >>> prod_false = get_product('1664', True) - File load error : sample-product-1664.json + File load error : sample/product-1664.json >>> prod_string = get_product('string', True) - File load error : sample-product-string.json + File load error : sample/product-string.json >>> print(prod_beurre['product_name']) Le VĂ©ritable Petit Beurre @@ -67,7 +67,7 @@ def get_product(code, from_file=False): """ ERR_FILE = "File load error : {}" - filename = 'sample-product-{}.json'.format(str(code)) + filename = 'sample/product-{}.json'.format(str(code)) try: int(code) @@ -150,7 +150,7 @@ def get_category(name, from_file=False): True >>> get_category('wrong_file', True) - File load error : sample-category-wrong_file.json + File load error : sample/category-wrong_file.json False # >>> pprint.pprint(prod_bisc) @@ -159,7 +159,7 @@ def get_category(name, from_file=False): if from_file: from os import path - filename = 'sample-category-{}.json'.format(str(name)) + filename = 'sample/category-{}.json'.format(str(name)) # File did not exists if path.isfile(filename) is False: print("File load error : {}".format(filename)) diff --git a/sample-category-biscuits.json b/sample/category-biscuits.json similarity index 100% rename from sample-category-biscuits.json rename to sample/category-biscuits.json diff --git a/sample-product-3017760000109.json b/sample/product-3017760000109.json similarity index 100% rename from sample-product-3017760000109.json rename to sample/product-3017760000109.json diff --git a/sample-product-8410000810004.json b/sample/product-8410000810004.json similarity index 100% rename from sample-product-8410000810004.json rename to sample/product-8410000810004.json