From 17dac42139a0688f62108b88c216c6b48f5acba5 Mon Sep 17 00:00:00 2001 From: andela-cdike Date: Sun, 27 Aug 2017 20:30:49 +0100 Subject: [PATCH 1/5] Tests should use separate shelve test database - Switch from depreccated yield_fixture to fixture decorator --- 19-dyn-attr-prop/oscon/test_schedule1.py | 9 +++++++-- 19-dyn-attr-prop/oscon/test_schedule2.py | 7 +++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/19-dyn-attr-prop/oscon/test_schedule1.py b/19-dyn-attr-prop/oscon/test_schedule1.py index dbaacc9..ba5dfd1 100644 --- a/19-dyn-attr-prop/oscon/test_schedule1.py +++ b/19-dyn-attr-prop/oscon/test_schedule1.py @@ -1,15 +1,20 @@ +import os import shelve + import pytest import schedule1 as schedule +DB_NAME = 'data/test_db' + -@pytest.yield_fixture +@pytest.fixture(scope='module') def db(): - with shelve.open(schedule.DB_NAME) as the_db: + with shelve.open(DB_NAME) as the_db: if schedule.CONFERENCE not in the_db: schedule.load_db(the_db) yield the_db + os.remove(DB_NAME) def test_record_class(): diff --git a/19-dyn-attr-prop/oscon/test_schedule2.py b/19-dyn-attr-prop/oscon/test_schedule2.py index de09d32..ab1c79c 100644 --- a/19-dyn-attr-prop/oscon/test_schedule2.py +++ b/19-dyn-attr-prop/oscon/test_schedule2.py @@ -1,15 +1,18 @@ +import os import shelve + import pytest import schedule2 as schedule -@pytest.yield_fixture +@pytest.fixture(scope='module') def db(): - with shelve.open(schedule.DB_NAME) as the_db: + with shelve.open(DB_NAME) as the_db: if schedule.CONFERENCE not in the_db: schedule.load_db(the_db) yield the_db + os.remove(DB_NAME) def test_record_attr_access(): From ca6c957cfff5bc3682ee554617e108c7426cf5e9 Mon Sep 17 00:00:00 2001 From: Simon Ilincev Date: Wed, 26 Aug 2020 11:28:08 +0200 Subject: [PATCH 2/5] correct LookupError We are no longer inside of the BingoCage class, so we should change the LookupError's wording to reflect that this is an error within the new LotteryBlower class. --- 11-iface-abc/lotto.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/11-iface-abc/lotto.py b/11-iface-abc/lotto.py index 2295b71..da8c2de 100644 --- a/11-iface-abc/lotto.py +++ b/11-iface-abc/lotto.py @@ -17,7 +17,7 @@ def pick(self): try: position = random.randrange(len(self._balls)) # <2> except ValueError: - raise LookupError('pick from empty BingoCage') + raise LookupError('pick from empty LotteryBlower') return self._balls.pop(position) # <3> def loaded(self): # <4> From 169d3c68c4012b7ebe36b79d73e9134a1a3f32de Mon Sep 17 00:00:00 2001 From: Tim Gates Date: Thu, 24 Dec 2020 16:20:29 +1100 Subject: [PATCH 3/5] docs: fix simple typo, shorcut -> shortcut There is a small typo in 18-asyncio/charfinder/charfinder.py, attic/concurrency/charfinder/charfinder.py. Should read `shortcut` rather than `shorcut`. --- 18-asyncio/charfinder/charfinder.py | 2 +- attic/concurrency/charfinder/charfinder.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/18-asyncio/charfinder/charfinder.py b/18-asyncio/charfinder/charfinder.py index 4e97a0a..c061f90 100755 --- a/18-asyncio/charfinder/charfinder.py +++ b/18-asyncio/charfinder/charfinder.py @@ -163,7 +163,7 @@ def find_chars(self, query, start=0, stop=None): result_sets = [] for word in tokenize(query): chars = self.index.get(word) - if chars is None: # shorcut: no such word + if chars is None: # shortcut: no such word result_sets = [] break result_sets.append(chars) diff --git a/attic/concurrency/charfinder/charfinder.py b/attic/concurrency/charfinder/charfinder.py index d18db89..72e21a4 100755 --- a/attic/concurrency/charfinder/charfinder.py +++ b/attic/concurrency/charfinder/charfinder.py @@ -165,7 +165,7 @@ def find_chars(self, query, start=0, stop=None): for word in tokenize(query): if word in self.index: result_sets.append(self.index[word]) - else: # shorcut: no such word + else: # shortcut: no such word result_sets = [] break if result_sets: From 7a2a652eab1febebf59ac9bca62c97081a997ee4 Mon Sep 17 00:00:00 2001 From: Luciano Ramalho Date: Sat, 19 Jun 2021 13:44:21 -0300 Subject: [PATCH 4/5] Update README.rst Fix suggested by @diraol --- 18-asyncio-py3.7/README.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/18-asyncio-py3.7/README.rst b/18-asyncio-py3.7/README.rst index 0f4f1b8..aad52a3 100644 --- a/18-asyncio-py3.7/README.rst +++ b/18-asyncio-py3.7/README.rst @@ -4,8 +4,8 @@ From the book "Fluent Python" by Luciano Ramalho (O'Reilly, 2015) http://shop.oreilly.com/product/0636920032519.do ################################################################## -NOTE: this "18b" directory contains the examples of chapter 18 -rewritten using the new async/await syntax available in Python 3.5 -ONLY, instead of the "yield-from" syntax which works since Python -3.3 (and will still work with Python 3.5). +NOTE: this directory contains the examples of chapter 18 +rewritten using the new async/await syntax available from Python +3.5+, instead of the "yield-from" syntax of Python 3.3 and 3.4. +The code was tested with Python 3.7 ################################################################## From d5133ad6e4a48eac0980d2418ed39d7ff693edbe Mon Sep 17 00:00:00 2001 From: Luciano Ramalho Date: Thu, 2 Dec 2021 11:39:34 -0300 Subject: [PATCH 5/5] Update README.rst --- README.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.rst b/README.rst index af75b88..39b95c4 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,8 @@ Fluent Python, First Edition: example code ========================================== +**This repository is archived and will not be updated. Please visit https://github.com/fluentpython/example-code-2e** + Example code for the book `Fluent Python, First Edition` by Luciano Ramalho (O'Reilly, 2015). * Code here may change and disappear without warning.