August 2018
Beginner
160 pages
4h 8m
English
When showing the explanation for short strings, pytest uses a simple difference method:
_____________________ test_default_player_class _____________________ def test_default_player_class(): x = get_default_player_class()> assert x == 'sorcerer'E AssertionError: assert 'warrior' == 'sorcerer'E - warriorE + sorcerer
Longer strings show a smarter delta, using difflib.ndiff to quickly spot the differences:
__________________ test_warrior_short_description ___________________ def test_warrior_short_description(): desc = get_short_class_description('warrior')> assert desc == 'A battle-hardened veteran, can equip heavy armor and weapons.'E AssertionError: assert 'A battle-har... and weapons.' == 'A battle-hard... and weapons.' ...Read now
Unlock full access