def test_extend_value(self): # _extend_value could be a module or staticmethod but since its # not, the test is here. b = base.Base() value_list = ['first', 'second'] new_value_list = ['new_first', 'new_second'] ret = b._extend_value(value_list, new_value_list) self.assertEquals(value_list + new_value_list, ret) ret_prepend = b._extend_value(value_list, new_value_list, prepend=True) self.assertEquals(new_value_list + value_list, ret_prepend) ret = b._extend_value(new_value_list, value_list) self.assertEquals(new_value_list + value_list, ret) ret = b._extend_value(new_value_list, value_list, prepend=True) self.assertEquals(value_list + new_value_list, ret) some_string = 'some string' ret = b._extend_value(some_string, new_value_list) self.assertEquals([some_string] + new_value_list, ret) new_value_string = 'this is the new values' ret = b._extend_value(some_string, new_value_string) self.assertEquals([some_string, new_value_string], ret) ret = b._extend_value(value_list, new_value_string) self.assertEquals(value_list + [new_value_string], ret)
def test_extend_value_none(self): b = base.Base() ret = b._extend_value(None, None) self.assertEquals(len(ret), 0) self.assertFalse(ret) ret = b._extend_value(None, ['foo']) self.assertEquals(ret, ['foo'])
def test_extend_value_none_list(self): b = base.Base() ret = b._extend_value(None, ['foo']) self.assertEquals(ret, ['foo'])
def test_extend_value_list_newstring(self): b = base.Base() value_list = ['first', 'second'] new_value_string = 'this is the new values' ret = b._extend_value(value_list, new_value_string) self.assertEquals(value_list + [new_value_string], ret)
def test_extend_value_string_newstring(self): b = base.Base() some_string = 'some string' new_value_string = 'this is the new values' ret = b._extend_value(some_string, new_value_string) self.assertEquals([some_string, new_value_string], ret)
def test_extend_value_string_newlist(self): b = base.Base() some_string = 'some string' new_value_list = ['new_first', 'new_second'] ret = b._extend_value(some_string, new_value_list) self.assertEquals([some_string] + new_value_list, ret)
def test_extend_value_newlist_list_prepend(self): b = base.Base() value_list = ['first', 'second'] new_value_list = ['new_first', 'new_second'] ret = b._extend_value(new_value_list, value_list, prepend=True) self.assertEquals(value_list + new_value_list, ret)
def test_extend_value_newlist_list(self): b = base.Base() value_list = ['first', 'second'] new_value_list = ['new_first', 'new_second'] ret = b._extend_value(new_value_list, value_list) self.assertEquals(new_value_list + value_list, ret)