Пример #1
0
    def test_get_list(self):
        contents = StringIO("""
list.0=A
list.1=B
list.2=C

order.1=B
order.0=A
order.2=C
""")
        p = DotProperties(contents)
        self.assertEqual(p.get_list("missing"), [])
        self.assertEqual(p.get_list("list"), ["A", "B", "C"])
        self.assertEqual(p.get_list("order"), ["A", "B", "C"])
Пример #2
0
    def test_get_list(self):
        contents = StringIO('''
list.0=A
list.1=B
list.2=C

order.1=B
order.0=A
order.2=C
''')
        p = DotProperties(contents)
        self.assertEqual(p.get_list('missing'), [])
        self.assertEqual(p.get_list('list'), ['A', 'B', 'C'])
        self.assertEqual(p.get_list('order'), ['A', 'B', 'C'])
Пример #3
0
    def test_get_list(self):
        contents = StringIO('''
list.0=A
list.1=B
list.2=C

order.1=B
order.0=A
order.2=C
''')
        p = DotProperties(contents)
        self.assertEqual(p.get_list('missing'), [])
        self.assertEqual(p.get_list('list'), ['A', 'B', 'C'])
        self.assertEqual(p.get_list('order'), ['A', 'B', 'C'])
Пример #4
0
    def test_get_list_with_shared_prefix(self):
        contents = StringIO('''
list.0=A
list.1=B
list.2=C

list.sublist.1=E
list.sublist.0=D
list.sublist.2=F

list.sublist.second.0=G

list.other.0=H
''')
        p = DotProperties(contents)
        self.assertEqual(p.get_list('list'), ['A', 'B', 'C'])
        self.assertEqual(p.get_list('list.sublist'), ['D', 'E', 'F'])
        self.assertEqual(p.get_list('list.sublist.second'), ['G'])
        self.assertEqual(p.get_list('list.other'), ['H'])
Пример #5
0
    def test_get_list_with_shared_prefix(self):
        contents = StringIO('''
list.0=A
list.1=B
list.2=C

list.sublist.1=E
list.sublist.0=D
list.sublist.2=F

list.sublist.second.0=G

list.other.0=H
''')
        p = DotProperties(contents)
        self.assertEqual(p.get_list('list'), ['A', 'B', 'C'])
        self.assertEqual(p.get_list('list.sublist'), ['D', 'E', 'F'])
        self.assertEqual(p.get_list('list.sublist.second'), ['G'])
        self.assertEqual(p.get_list('list.other'), ['H'])
Пример #6
0
    def test_get_list_with_shared_prefix(self):
        contents = StringIO("""
list.0=A
list.1=B
list.2=C

list.sublist.1=E
list.sublist.0=D
list.sublist.2=F

list.sublist.second.0=G

list.other.0=H
""")
        p = DotProperties(contents)
        self.assertEqual(p.get_list("list"), ["A", "B", "C"])
        self.assertEqual(p.get_list("list.sublist"), ["D", "E", "F"])
        self.assertEqual(p.get_list("list.sublist.second"), ["G"])
        self.assertEqual(p.get_list("list.other"), ["H"])
Пример #7
0
    def test_unicode(self):
        contents = StringIO('''
# Danish.
# ####  ~~ Søren Munk Skrøder, sskroeder - 2009-05-30 @ #mozmae

# Korean.
A.title=한메일

# Russian.
list.0 = test
list.1 = Яндекс
''')
        p = DotProperties(contents)
        self.assertEqual(p.get_dict('A'), {'title': '한메일'})
        self.assertEqual(p.get_list('list'), ['test', 'Яндекс'])
Пример #8
0
    def test_unicode(self):
        contents = StringIO('''
# Danish.
# ####  ~~ Søren Munk Skrøder, sskroeder - 2009-05-30 @ #mozmae

# Korean.
A.title=한메일

# Russian.
list.0 = test
list.1 = Яндекс
''')
        p = DotProperties(contents)
        self.assertEqual(p.get_dict('A'), {'title': '한메일'})
        self.assertEqual(p.get_list('list'), ['test', 'Яндекс'])
Пример #9
0
    def test_unicode(self):
        contents = StringIO("""
# Danish.
# ####  ~~ Søren Munk Skrøder, sskroeder - 2009-05-30 @ #mozmae

# Korean.
A.title=한메일

# Russian.
list.0 = test
list.1 = Яндекс
""")
        p = DotProperties(contents)
        self.assertEqual(p.get_dict("A"), {"title": "한메일"})
        self.assertEqual(p.get_list("list"), ["test", "Яндекс"])
Пример #10
0
 def test_valid_unicode_from_file(self):
     # The contents of valid.properties is identical to the contents of the
     # test above.  This specifically exercises reading from a file.
     p = DotProperties(os.path.join(test_data_path, 'valid.properties'))
     self.assertEqual(p.get_dict('A'), {'title': '한메일'})
     self.assertEqual(p.get_list('list'), ['test', 'Яндекс'])
Пример #11
0
 def test_valid_unicode_from_file(self):
     # The contents of valid.properties is identical to the contents of the
     # test above.  This specifically exercises reading from a file.
     p = DotProperties(os.path.join(test_data_path, 'valid.properties'))
     self.assertEqual(p.get_dict('A'), {'title': '한메일'})
     self.assertEqual(p.get_list('list'), ['test', 'Яндекс'])
Пример #12
0
 def test_valid_unicode_from_file(self):
     # The contents of valid.properties is identical to the contents of the
     # test above.  This specifically exercises reading from a file.
     p = DotProperties(os.path.join(test_data_path, "valid.properties"))
     self.assertEqual(p.get_dict("A"), {"title": "한메일"})
     self.assertEqual(p.get_list("list"), ["test", "Яндекс"])