@@ -0,0 +1,2370 @@
+# Copyright 2014 DataStax, Inc.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or agreed to in writing, software%0A# distributed under the License is distributed on an %22AS IS%22 BASIS,%0A# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A# See the License for the specific language governing permissions and%0A# limitations under the License.%0A%0Atry:%0A    import unittest2 as unittest%0Aexcept ImportError:%0A    import unittest%0A%0Afrom cassandra import Unavailable, Timeout, ConsistencyLevel%0Aimport re%0A%0A%0Aclass ConsistencyExceptionTest(unittest.TestCase):%0A    %22%22%22%0A    Verify Cassandra Exception string representation%0A    %22%22%22%0A%0A    def extract_consistency(self, msg):%0A        %22%22%22%0A        Given message that has 'consistency': 'value', extract consistency value as a string%0A        :param msg: message with consistency value%0A        :return: String representing consistency value%0A        %22%22%22%0A        match = re.search(%22'consistency':%5Cs+'(%5B%5Cw%5Cs%5D+)'%22, msg)%0A        return match and match.group(1)%0A%0A    def test_timeout_consistency(self):%0A        %22%22%22%0A        Verify that Timeout exception object translates consistency from input value to correct output string%0A        %22%22%22%0A        consistency_str = self.extract_consistency(repr(Timeout(%22Timeout Message%22, consistency=None)))%0A        self.assertEqual(consistency_str, 'Not Set')%0A        for c in ConsistencyLevel.value_to_name.keys():%0A            consistency_str = self.extract_consistency(repr(Timeout(%22Timeout Message%22, consistency=c)))%0A        self.assertEqual(consistency_str, ConsistencyLevel.value_to_name%5Bc%5D)%0A%0A    def test_unavailable_consistency(self):%0A        %22%22%22%0A        Verify that Unavailable exception object translates consistency from input value to correct output string%0A        %22%22%22%0A        consistency_str = self.extract_consistency(repr(Unavailable(%22Unavailable Message%22, consistency=None)))%0A        self.assertEqual(consistency_str, 'Not Set')%0A        for c in ConsistencyLevel.value_to_name.keys():%0A            consistency_str = self.extract_consistency(repr(Unavailable(%22Timeout Message%22, consistency=c)))%0A        self.assertEqual(consistency_str, ConsistencyLevel.value_to_name%5Bc%5D)%0A

Test for PYTHON-180