<s> import tempfile <EOL> import shutil <EOL> import os <EOL> from Pyblosxom . tests import PluginTest <EOL> from Pyblosxom . plugins import tags <EOL> from Pyblosxom . pyblosxom import Request <EOL> class TagsTest ( PluginTest ) : <EOL> def setUp ( self ) : <EOL> PluginTest . setUp ( self , tags ) <EOL> self . tmpdir = tempfile . mkdtemp ( ) <EOL> def get_datadir ( self ) : <EOL> return os . path . join ( self . tmpdir , "<STR_LIT>" ) <EOL> def tearDown ( self ) : <EOL> PluginTest . tearDown ( self ) <EOL> try : <EOL> shutil . rmtree ( self . tmpdir ) <EOL> except OSError : <EOL> pass <EOL> def test_get_tagsfile ( self ) : <EOL> req = Request ( { "<STR_LIT>" : self . get_datadir ( ) } , { } , { } ) <EOL> cfg = { "<STR_LIT>" : self . get_datadir ( ) } <EOL> self . assertEquals ( tags . get_tagsfile ( cfg ) , <EOL> os . path . join ( self . get_datadir ( ) , os . pardir , <EOL> "<STR_LIT>" ) ) <EOL> tags_filename = os . path . join ( self . get_datadir ( ) , "<STR_LIT>" ) <EOL> cfg = { "<STR_LIT>" : self . get_datadir ( ) , "<STR_LIT>" : tags_filename } <EOL> self . assertEquals ( tags . get_tagsfile ( cfg ) , tags_filename ) <EOL> def test_tag_cloud_no_tags ( self ) : <EOL> self . request . get_data ( ) [ "<STR_LIT>" ] = { } <EOL> tags . cb_head ( self . args ) <EOL> self . assertEquals ( <EOL> str ( self . args [ "<STR_LIT>" ] [ "<STR_LIT>" ] ) , <EOL> "<STR_LIT:\n>" . join ( <EOL> [ "<STR_LIT>" , <EOL> "<STR_LIT>" ] ) ) <EOL> def test_tag_cloud_one_tag ( self ) : <EOL> self . request . get_data ( ) [ "<STR_LIT>" ] = { <EOL> "<STR_LIT>" : [ "<STR_LIT:a>" ] , <EOL> } <EOL> tags . cb_head ( self . args ) <EOL> self . assertEquals ( <EOL> str ( self . args [ "<STR_LIT>" ] [ "<STR_LIT>" ] ) , <EOL> "<STR_LIT:\n>" . join ( <EOL> [ "<STR_LIT>" , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" ] ) ) <EOL> def test_tag_cloud_many_tags ( self ) : <EOL> self . request . get_data ( ) [ "<STR_LIT>" ] = { <EOL> "<STR_LIT>" : [ "<STR_LIT:a>" , "<STR_LIT:b>" , "<STR_LIT:c>" , "<STR_LIT:d>" , "<STR_LIT:e>" , "<STR_LIT:f>" ] , <EOL> "<STR_LIT>" : [ "<STR_LIT:a>" , "<STR_LIT:b>" , "<STR_LIT:c>" , "<STR_LIT:d>" ] , <EOL> "<STR_LIT>" : [ "<STR_LIT:a>" ] <EOL> } <EOL> tags . cb_head ( self . args ) <EOL> self . assertEquals ( <EOL> str ( self . args [ "<STR_LIT>" ] [ "<STR_LIT>" ] ) , <EOL> "<STR_LIT:\n>" . join ( <EOL> [ "<STR_LIT>" , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> "<STR_LIT>" ] ) ) </s>
