mirror of
https://github.com/jongracecox/anybadge.git
synced 2026-01-04 19:32:11 +01:00
Add repr and str dunder functions
* Add __repr__ function that prints the object representation. * Add __str__ function that prints the Badge SVG text. Also: * Add constructor args to the Badge class docstring. * Change the way defaults are used in the Badge constuctor. Instead of setting values, use None and set arguments to the default values inside the constructor. * Fix unittests that don't use overwrite=True.
This commit is contained in:
@@ -94,7 +94,7 @@ class TestAnybadge(TestCase):
|
||||
badge = Badge('test', '2.22', value_suffix='%',
|
||||
thresholds=thresholds)
|
||||
|
||||
badge.write_badge('test_badge_8.svg')
|
||||
badge.write_badge('test_badge_8.svg', overwrite=True)
|
||||
|
||||
def test_badge_with_text_color(self):
|
||||
"""Test generating a badge with alternate text_color."""
|
||||
@@ -102,4 +102,4 @@ class TestAnybadge(TestCase):
|
||||
badge = Badge('test', '2.22', value_suffix='%',
|
||||
text_color='#010101,#101010')
|
||||
|
||||
badge.write_badge('test_badge_9.svg')
|
||||
badge.write_badge('test_badge_9.svg', overwrite=True)
|
||||
|
||||
Reference in New Issue
Block a user