Add a theme section in the configuration file to allow users to set the colors used by different elements of the ui. Improve the update mechanism so that incremental changes to the configuration file can be incorporated.
34 lines
990 B
Python
34 lines
990 B
Python
# -*- coding: utf-8 -*-
|
|
import unittest
|
|
import os
|
|
|
|
import dotdot
|
|
import fake_env
|
|
|
|
from pubs import endecoder, pretty, color, config
|
|
|
|
from str_fixtures import bibtex_raw0
|
|
|
|
|
|
class TestPretty(unittest.TestCase):
|
|
|
|
def setUp(self):
|
|
conf = config.load_default_conf()
|
|
color.setup(conf)
|
|
|
|
def test_oneliner(self):
|
|
decoder = endecoder.EnDecoder()
|
|
bibdata = decoder.decode_bibdata(bibtex_raw0)
|
|
line = u'Page, Lawrence et al. "The PageRank Citation Ranking: Bringing Order to the Web." (1999)'
|
|
self.assertEqual(pretty.bib_oneliner(bibdata['Page99']), line)
|
|
|
|
def test_oneliner_no_year(self):
|
|
decoder = endecoder.EnDecoder()
|
|
bibdata = decoder.decode_bibdata(bibtex_raw0)
|
|
bibdata['Page99'].pop('year')
|
|
line = u'Page, Lawrence et al. "The PageRank Citation Ranking: Bringing Order to the Web."'
|
|
self.assertEqual(pretty.bib_oneliner(bibdata['Page99']), line)
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|