Skip to content

Commit 432cfca

Browse files
author
Michał Karaś
committed
remove f-strings for python 3.5 compatibility
1 parent 22294d3 commit 432cfca

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

deepdiff/diff.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -789,8 +789,8 @@ def pretty_print_diff(diff: DiffLevel):
789789
type_t1 = get_type(diff.t1).__name__
790790
type_t2 = get_type(diff.t2).__name__
791791

792-
val_t1 = f'"{str(diff.t1)}"' if type_t1 == "str" else str(diff.t1)
793-
val_t2 = f'"{str(diff.t2)}"' if type_t2 == "str" else str(diff.t2)
792+
val_t1 = '"{}"'.format(str(diff.t1)) if type_t1 == "str" else str(diff.t1)
793+
val_t2 = '"{}"'.format(str(diff.t2)) if type_t2 == "str" else str(diff.t2)
794794

795795
diff_path = diff.path(root='root')
796796

tests/test_diff_tree.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def test_pretty_print_diff_type_changes(self, t1, t2, item_path, old_type, new_t
205205
new_val_displayed):
206206
ddiff = DeepDiff(t1, t2, view='tree')
207207
result = pretty_print_diff(ddiff.tree['type_changes'].items[0])
208-
assert result == f'Type of {item_path} changed from {old_type} to {new_type} and value changed from {old_val_displayed} to {new_val_displayed}.'
208+
assert result == 'Type of {} changed from {} to {} and value changed from {} to {}.'.format(item_path, old_type, new_type, old_val_displayed, new_val_displayed)
209209

210210
@pytest.mark.parametrize('t1, t2, item_path',
211211
[
@@ -214,7 +214,7 @@ def test_pretty_print_diff_type_changes(self, t1, t2, item_path, old_type, new_t
214214
def test_pretty_print_diff_dictionary_item_added(self, t1, t2, item_path):
215215
ddiff = DeepDiff(t1, t2, view='tree')
216216
result = pretty_print_diff(ddiff.tree['dictionary_item_added'].items[0])
217-
assert result == f'Item {item_path} added to dictionary.'
217+
assert result == 'Item {} added to dictionary.'.format(item_path)
218218

219219
@pytest.mark.parametrize('t1, t2, item_path',
220220
[
@@ -223,7 +223,7 @@ def test_pretty_print_diff_dictionary_item_added(self, t1, t2, item_path):
223223
def test_pretty_print_diff_dictionary_item_removed(self, t1, t2, item_path):
224224
ddiff = DeepDiff(t1, t2, view='tree')
225225
result = pretty_print_diff(ddiff.tree['dictionary_item_removed'].items[0])
226-
assert result == f'Item {item_path} removed from dictionary.'
226+
assert result == 'Item {} removed from dictionary.'.format(item_path)
227227

228228
@pytest.mark.parametrize('t1, t2, item_path, old_val_displayed, new_val_displayed',
229229
[
@@ -233,7 +233,7 @@ def test_pretty_print_diff_dictionary_item_removed(self, t1, t2, item_path):
233233
def test_pretty_print_diff_values_changed(self, t1, t2, item_path, old_val_displayed, new_val_displayed):
234234
ddiff = DeepDiff(t1, t2, view='tree')
235235
result = pretty_print_diff(ddiff.tree['values_changed'].items[0])
236-
assert result == f'Value of {item_path} changed from {old_val_displayed} to {new_val_displayed}.'
236+
assert result == 'Value of {} changed from {} to {}.'.format(item_path, old_val_displayed, new_val_displayed)
237237

238238
@pytest.mark.parametrize('t1, t2, item_path',
239239
[
@@ -242,7 +242,7 @@ def test_pretty_print_diff_values_changed(self, t1, t2, item_path, old_val_displ
242242
def test_pretty_print_diff_iterable_item_added(self, t1, t2, item_path):
243243
ddiff = DeepDiff(t1, t2, view='tree')
244244
result = pretty_print_diff(ddiff.tree['iterable_item_added'].items[0])
245-
assert result == f'Item {item_path} added to iterable.'
245+
assert result == 'Item {} added to iterable.'.format(item_path)
246246

247247
@pytest.mark.parametrize('t1, t2, item_path',
248248
[
@@ -251,7 +251,7 @@ def test_pretty_print_diff_iterable_item_added(self, t1, t2, item_path):
251251
def test_pretty_print_diff_iterable_item_removed(self, t1, t2, item_path):
252252
ddiff = DeepDiff(t1, t2, view='tree')
253253
result = pretty_print_diff(ddiff.tree['iterable_item_removed'].items[0])
254-
assert result == f'Item {item_path} removed from iterable.'
254+
assert result == 'Item {} removed from iterable.'.format(item_path)
255255

256256
def test_pretty_print_diff_attribute_added(self):
257257
t1 = self.testing_class()
@@ -269,7 +269,7 @@ def test_pretty_print_diff_attribute_removed(self):
269269

270270
ddiff = DeepDiff(t1, t2, view='tree')
271271
result = pretty_print_diff(ddiff.tree['attribute_removed'].items[0])
272-
assert result == f'Attribute root.two removed.'
272+
assert result == 'Attribute root.two removed.'
273273

274274
@pytest.mark.parametrize('t1, t2, item_path',
275275
[
@@ -278,7 +278,7 @@ def test_pretty_print_diff_attribute_removed(self):
278278
def test_pretty_print_diff_set_item_added(self, t1, t2, item_path):
279279
ddiff = DeepDiff(t1, t2, view='tree')
280280
result = pretty_print_diff(ddiff.tree['set_item_added'].items[0])
281-
assert result == f'Item {item_path} added to set.'
281+
assert result == 'Item {} added to set.'.format(item_path)
282282

283283
@pytest.mark.parametrize('t1, t2, item_path',
284284
[
@@ -287,7 +287,7 @@ def test_pretty_print_diff_set_item_added(self, t1, t2, item_path):
287287
def test_pretty_print_diff_set_item_removed(self, t1, t2, item_path):
288288
ddiff = DeepDiff(t1, t2, view='tree')
289289
result = pretty_print_diff(ddiff.tree['set_item_removed'].items[0])
290-
assert result == f'Item {item_path} removed from set.'
290+
assert result == 'Item {} removed from set.'.format(item_path)
291291

292292
@pytest.mark.parametrize('t1, t2, item_path',
293293
[
@@ -296,7 +296,7 @@ def test_pretty_print_diff_set_item_removed(self, t1, t2, item_path):
296296
def test_pretty_print_diff_repetition_change(self, t1, t2, item_path):
297297
ddiff = DeepDiff(t1, t2, view='tree', ignore_order=True, report_repetition=True)
298298
result = pretty_print_diff(ddiff.tree['repetition_change'].items[0])
299-
assert result == f'Repetition change for item {item_path}.'
299+
assert result == 'Repetition change for item {}.'.format(item_path)
300300

301301
def test_pretty_form_method(self):
302302
t1 = {2: 2, 3: 3, 4: 4}

0 commit comments

Comments
 (0)