From f4f3f35f184966c59d7622170820d3389a02288f Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Mon, 24 May 2021 16:32:18 +0300 Subject: Fix is_mac (Python 3) --- gsxws/products.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'gsxws') diff --git a/gsxws/products.py b/gsxws/products.py index dfc4194..98b092b 100644 --- a/gsxws/products.py +++ b/gsxws/products.py @@ -7,10 +7,10 @@ import re import os import json -from .utils import fetch_url -from .lookups import Lookup -from .diagnostics import Diagnostics -from .core import GsxObject, GsxError, validate +from gsxws.utils import fetch_url +from gsxws.lookups import Lookup +from gsxws.diagnostics import Diagnostics +from gsxws.core import GsxObject, GsxError, validate def models(): @@ -211,7 +211,13 @@ class Product(object): @property def is_mac(self): - return re.match(r'^i?Mac', self.description) + """ + >>> product = Product('DGKFL06JDHJP') + >>> product.description = "MacBook Pro" + >>> product.is_mac + True + """ + return (re.match(r'^i?Mac', self.description) != None) @property def is_iphone(self): @@ -263,7 +269,7 @@ if __name__ == '__main__': import sys import doctest import logging - from .core import connect + from gsxws.core import connect logging.basicConfig(level=logging.DEBUG) connect(*sys.argv[1:]) doctest.testmod() -- cgit v1.2.3