@@ -1116,19 +1116,15 @@ def test_last_returns_newest_key(self):
11161116
11171117 def test_first_with_positive_n_browses_in_insertion_order (self ):
11181118 """first(n) must walk forward through insertion order."""
1119- cache = self .create_cache (
1120- 4 , [(10 , "a" ), (20 , "b" ), (30 , "c" ), (40 , "d" )], global_ttl = 10
1121- )
1119+ cache = self .create_cache (4 , [(10 , "a" ), (20 , "b" ), (30 , "c" ), (40 , "d" )], global_ttl = 10 )
11221120 assert cache .first (0 ) == 10
11231121 assert cache .first (1 ) == 20
11241122 assert cache .first (2 ) == 30
11251123 assert cache .first (3 ) == 40
11261124
11271125 def test_first_with_negative_n_browses_from_end (self ):
11281126 """first(-1) is an alias for last(); first(-2) is the second newest."""
1129- cache = self .create_cache (
1130- 4 , [(10 , "a" ), (20 , "b" ), (30 , "c" ), (40 , "d" )], global_ttl = 10
1131- )
1127+ cache = self .create_cache (4 , [(10 , "a" ), (20 , "b" ), (30 , "c" ), (40 , "d" )], global_ttl = 10 )
11321128 assert cache .first (- 1 ) == 40
11331129 assert cache .first (- 2 ) == 30
11341130
@@ -1750,9 +1746,7 @@ def test_get_with_expire(self):
17501746 time .sleep (0.1 )
17511747 value , dur = obj .get_with_expire (1 )
17521748 assert 1 == value
1753- assert isinstance (dur , float ) and 10 > dur > 9 , (
1754- "10 > dur > 9 failed [dur: %f]" % dur
1755- )
1749+ assert isinstance (dur , float ) and 10 > dur > 9 , "10 > dur > 9 failed [dur: %f]" % dur
17561750
17571751 obj .insert (1 , 1 , None )
17581752 time .sleep (0.1 )
@@ -1775,9 +1769,7 @@ def test_pop_with_expire(self):
17751769 time .sleep (0.1 )
17761770 value , dur = obj .pop_with_expire (1 )
17771771 assert 1 == value
1778- assert isinstance (dur , float ) and 10 > dur > 9 , (
1779- "10 > dur > 9 failed [dur: %f]" % dur
1780- )
1772+ assert isinstance (dur , float ) and 10 > dur > 9 , "10 > dur > 9 failed [dur: %f]" % dur
17811773
17821774 obj .insert (1 , 1 , None )
17831775 time .sleep (0.1 )
@@ -1801,15 +1793,11 @@ def test_popitem_with_expire(self):
18011793 time .sleep (0.1 )
18021794 key , value , dur = obj .popitem_with_expire ()
18031795 assert (1 , 1 ) == (key , value )
1804- assert isinstance (dur , float ) and 10 > dur > 9 , (
1805- "10 > dur > 9 failed [dur: %f]" % dur
1806- )
1796+ assert isinstance (dur , float ) and 10 > dur > 9 , "10 > dur > 9 failed [dur: %f]" % dur
18071797
18081798 key , value , dur = obj .popitem_with_expire ()
18091799 assert (2 , 2 ) == (key , value )
1810- assert isinstance (dur , float ) and 20 > dur > 19 , (
1811- "20 > dur > 19 failed [dur: %f]" % dur
1812- )
1800+ assert isinstance (dur , float ) and 20 > dur > 19 , "20 > dur > 19 failed [dur: %f]" % dur
18131801
18141802 with pytest .raises (KeyError ):
18151803 obj .popitem_with_expire ()
0 commit comments