-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Contrast - now working and documented!
- Loading branch information
1 parent
960383c
commit 9880804
Showing
4 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import unittest | ||
import colourettu | ||
|
||
|
||
class Test_Contrast(unittest.TestCase): | ||
|
||
def test_contrast_white_white(self): | ||
'''The Contrast of White and White should be 1''' | ||
self.assertAlmostEqual(colourettu.contrast('#FFF', '#FFF'), 1) | ||
|
||
def test_contrast_black_black(self): | ||
'''The Contrast of Black and Black should be 1''' | ||
self.assertAlmostEqual(colourettu.contrast('#000', '#000'), 1) | ||
|
||
def test_contrast_white_black(self): | ||
'''The Contrast of White and Black should be 21''' | ||
self.assertAlmostEqual(colourettu.contrast('#FFF', '#000'), 21) | ||
|
||
def test_contrast_from_colour(self): | ||
'''The Contrast of a provided colour against White''' | ||
colour1 = colourettu.colour("#cde") | ||
self.assertTrue(colour1.contrast("#FFF")) | ||
|
||
|
||
def main(): | ||
unittest.main() | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |