def test_single_nested_list_values_default(self): value = SingleNestedListValue() with env(DJANGO_TEST='2,3;4,5'): expected = [['2', '3'], ['4', '5']] self.assertEqual(value.setup('TEST'), expected) with env(DJANGO_TEST='2;3;4;5'): expected = [['2'], ['3'], ['4'], ['5']] self.assertEqual(value.setup('TEST'), expected) with env(DJANGO_TEST='2,3,4,5'): expected = [['2', '3', '4', '5']] self.assertEqual(value.setup('TEST'), expected) with env(DJANGO_TEST='2, 3 , ; 4 , 5 ; '): expected = [['2', '3'], ['4', '5']] self.assertEqual(value.setup('TEST'), expected) with env(DJANGO_TEST=''): self.assertEqual(value.setup('TEST'), [])
def test_single_nested_list_values_converter(self): value = SingleNestedListValue(converter=int) with env(DJANGO_TEST='2,3;4,5'): self.assertEqual(value.setup('TEST'), [[2, 3], [4, 5]])
def test_single_nested_list_values_separator(self): value = SingleNestedListValue(seq_separator=':') with env(DJANGO_TEST='2,3:4,5'): self.assertEqual(value.setup('TEST'), [['2', '3'], ['4', '5']])