Exemplo n.º 1
0
 def setUp(self):
     self.filename = tempfile.mktemp()
     contents = dict()
     for i in range(1000):
         contents["key%d" % i] = "value%d" % i
     languages.write_dict(self.filename, contents)
     languages.read_dict(self.filename)
Exemplo n.º 2
0
 def test_update_all_languages(self):
     languages.update_all_languages(self.apppath)
     en_file = os.path.join(self.apppath, 'languages', 'en.py')
     pt_file = os.path.join(self.apppath, 'languages', 'pt.py')
     en_dict = languages.read_dict(en_file)
     pt_dict = languages.read_dict(pt_file)
     for key in ['hello', 'world', '%s %%{shop}', 'ahoy']:
         self.assertTrue(key in en_dict)
         self.assertTrue(key in pt_dict)
Exemplo n.º 3
0
 def read_write(args):
     (filename, iterations) = args
     for i in range(0, iterations):
         content = languages.read_dict(filename)
         if not len(content):
             return False
         languages.write_dict(filename, content)
     return True