def test_double_strings_from_file(self): doubles = DoubleStringCharSplitCollection() self.assertIsNotNone(doubles) count = doubles.load_from_filename( os.path.dirname(__file__) + os.sep + "test_files/doubles.txt") self.assertEqual(count, 3) self.assertTrue(doubles.has_key("key1")) self.assertEqual(doubles.value("key1"), "val1") self.assertTrue(doubles.has_key("key2")) self.assertEqual(doubles.value("key2"), "val2") self.assertTrue(doubles.has_key("key3")) self.assertEqual(doubles.value("key3"), "val3,val4")
def test_double_strings_from_file(self): doubles = DoubleStringCharSplitCollection () self.assertIsNotNone(doubles) count = doubles.load_from_filename(os.path.dirname(__file__) + os.sep + "test_files/doubles.txt") self.assertEqual(count, 3) self.assertTrue(doubles.has_key("key1")) self.assertEqual(doubles.value("key1"), "val1") self.assertTrue(doubles.has_key("key2")) self.assertEqual(doubles.value("key2"), "val2") self.assertTrue(doubles.has_key("key3")) self.assertEqual(doubles.value("key3"), "val3,val4")
def __init__(self, process_splits_success=True): DoubleStringCharSplitCollection.__init__(self) self._process_splits_success = process_splits_success
def test_double_strings_from_text(self): doubles = DoubleStringCharSplitCollection () self.assertIsNotNone(doubles) count = doubles.load_from_text(""" key1,val1 key2,val2 key3,val3,val4 """) self.assertEqual(count, 3) self.assertTrue(doubles.has_key("key1")) self.assertEqual(doubles.value("key1"), "val1") self.assertTrue(doubles.has_key("key2")) self.assertEqual(doubles.value("key2"), "val2") self.assertTrue(doubles.has_key("key3")) self.assertEqual(doubles.value("key3"), "val3,val4") self.assertFalse(doubles.has_key("key4")) doubles.add_value("key4", "val5") self.assertTrue(doubles.has_key("key4")) self.assertEqual(doubles.value("key4"), "val5") doubles.set_value("key4", "val6") self.assertEqual(doubles.value("key4"), "val6")
def __init__(self): DoubleStringCharSplitCollection.__init__(self)
def __init__(self): DoubleStringCharSplitCollection.__init__(self)
def __init__(self, process_splits_success=True): DoubleStringCharSplitCollection.__init__(self) self._process_splits_success = process_splits_success
def test_double_strings_from_text(self): doubles = DoubleStringCharSplitCollection() self.assertIsNotNone(doubles) count = doubles.load_from_text(""" key1,val1 key2,val2 key3,val3,val4 """) self.assertEqual(count, 3) self.assertTrue(doubles.has_key("key1")) self.assertEqual(doubles.value("key1"), "val1") self.assertTrue(doubles.has_key("key2")) self.assertEqual(doubles.value("key2"), "val2") self.assertTrue(doubles.has_key("key3")) self.assertEqual(doubles.value("key3"), "val3,val4") self.assertFalse(doubles.has_key("key4")) doubles.add_value("key4", "val5") self.assertTrue(doubles.has_key("key4")) self.assertEqual(doubles.value("key4"), "val5") doubles.set_value("key4", "val6") self.assertEqual(doubles.value("key4"), "val6")
def __init__(self, errors_dict=None): DoubleStringCharSplitCollection.__init__(self) self._errors_dict = errors_dict