Back to index

moin  1.9.0~rc2
Public Member Functions | Static Public Attributes
MoinMoin.datastruct.backends._tests.test_wiki_dicts.TestWikiDictsBackend Class Reference
Inheritance diagram for MoinMoin.datastruct.backends._tests.test_wiki_dicts.TestWikiDictsBackend:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.datastruct.backends._tests.test_wiki_dicts.TestWikiDictsBackend:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def setup_class
def teardown_class
def test_getitem
def test_contains
def test_update
def test_get

Static Public Attributes

dictionary dicts

Detailed Description

Definition at line 17 of file test_wiki_dicts.py.


Member Function Documentation

Definition at line 22 of file test_wiki_dicts.py.

00022 
00023     def setup_class(self):
00024         request = self.request
00025         become_trusted(request)
00026 
00027         text = '''
00028 Text ignored
00029  * list items ignored
00030   * Second level list ignored
00031  First:: first item
00032  text with spaces:: second item
00033 
00034 Empty lines ignored, so is this text
00035 Next line has key with empty value
00036  Empty string::\x20
00037  Last:: last item
00038 '''
00039         create_page(request, u'SomeTestDict', text)
00040 
00041         text = """
00042  One:: 1
00043  Two:: 2
00044 """
00045         create_page(request, u'SomeOtherTestDict', text)

Here is the call graph for this function:

Definition at line 46 of file test_wiki_dicts.py.

00046 
00047     def teardown_class(self):
00048         become_trusted(self.request)
00049         nuke_page(self.request, u'SomeTestDict')
00050         nuke_page(self.request, u'SomeOtherTestDict')
00051 

Here is the call graph for this function:

Definition at line 160 of file __init__.py.

00160 
00161     def test_contains(self):
00162         dicts = self.request.dicts
00163 
00164         for key in self.dicts:
00165             assert key in dicts
00166 
00167         assert u'SomeNotExistingDict' not in dicts

Definition at line 176 of file __init__.py.

00176 
00177     def test_get(self):
00178         dicts = self.request.dicts
00179 
00180         for dict_name in self.dicts:
00181             assert dicts.get(dict_name)
00182 
00183         assert u'SomeNotExistingDict' not in dicts
00184         assert dicts.get(u'SomeNotExistingDict') is None
00185         assert dicts.get(u'SomeNotExistingDict', {}) == {}
00186 
00187 
00188         for dict_name, expected_dict in self.dicts.items():
00189             test_dict = dicts[dict_name]
00190             for key, value in expected_dict.items():
00191                 assert u'SomeNotExistingKey' not in test_dict
00192                 assert test_dict.get(u'SomeNotExistingKey') is None
00193                 assert test_dict.get(u'SomeNotExistingKey', {}) == {}
00194 

Definition at line 150 of file __init__.py.

00150 
00151     def test_getitem(self):
00152         expected_dicts = self.dicts
00153         dicts = self.request.dicts
00154 
00155         for dict_name, expected_dict in expected_dicts.items():
00156             test_dict = dicts[dict_name]
00157             assert len(test_dict) == len(expected_dict)
00158             for key, value in expected_dict.items():
00159                 assert test_dict[key] == value

Definition at line 168 of file __init__.py.

00168 
00169     def test_update(self):
00170         dicts = self.request.dicts
00171 
00172         d = {}
00173         d.update(dicts['SomeTestDict'])
00174 
00175         assert u'First' in d


Member Data Documentation

Initial value:
{u'SomeTestDict': {u'First': u'first item',
                               u'text with spaces': u'second item',
                               u'Empty string': u'',
                               u'Last': u'last item'},
             u'SomeOtherTestDict': {u'One': '1',
                                    u'Two': '2'}}

Definition at line 143 of file __init__.py.


The documentation for this class was generated from the following file: