Esempio n. 1
0
    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")
Esempio n. 2
0
    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")
Esempio n. 3
0
 def __init__(self, process_splits_success=True):
     DoubleStringCharSplitCollection.__init__(self)
     self._process_splits_success = process_splits_success
Esempio n. 4
0
    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")
Esempio n. 5
0
 def __init__(self):
     DoubleStringCharSplitCollection.__init__(self)
Esempio n. 6
0
 def __init__(self):
     DoubleStringCharSplitCollection.__init__(self)
Esempio n. 7
0
 def __init__(self, process_splits_success=True):
     DoubleStringCharSplitCollection.__init__(self)
     self._process_splits_success = process_splits_success
Esempio n. 8
0
    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")
Esempio n. 9
0
 def __init__(self, errors_dict=None):
     DoubleStringCharSplitCollection.__init__(self)
     self._errors_dict = errors_dict