def test_existent_font(self, load_default_mock, path_exists_mock, truetype_mock): path_exists_mock.return_value = True truetype_mock.return_value = 'existent_font' font = get_font(fontfullpath=os.path.abspath('/foo/bar/'), fontsize=15) self.assertTrue(font, 'existent_font') self.assertFalse(load_default_mock.called)
def _set_font(self): '''Sets object's font''' self.font = get_font(self.path, self.size) self.is_default = self.font.is_default
def test_with_none_params(self, load_default_mock): get_font(fontfullpath=None, fontsize=None) self.assertTrue(load_default_mock.called)
def test_with_nonexistent_fontfullpath(self, load_default_mock): with self.assertWarns(FontNotFoundWarning): get_font(fontfullpath='foo/bar', fontsize=None) self.assertTrue(load_default_mock.called)
def _set_font(self): '''Sets object's font''' self.font = get_font(self.fontfullpath, self.fontsize)