Exemplo n.º 1
0
class PythonValueTestCase(unittest.TestCase):
    """Tests for converting the database value to Python type."""
    def setUp(self):
        self.f = ArrayField()

    def test_none_returns_none(self):
        self.assertIsNone(self.f.to_python(None))

    def test_empty_list_returns_empty_list(self):
        self.assertEqual(self.f.to_python([]), [])

    def test_list_returns_list(self):
        self.assertEqual(self.f.to_python([1, 2]), [1, 2])
class PythonValueTestCase(unittest.TestCase):
    """Tests for converting the database value to Python type."""

    def setUp(self):
        self.f = ArrayField()

    def test_none_returns_none(self):
        self.assertIsNone(self.f.to_python(None))

    def test_empty_list_returns_empty_list(self):
        self.assertEqual(self.f.to_python([]), [])

    def test_list_returns_list(self):
        self.assertEqual(self.f.to_python([1, 2]), [1, 2])