def test_ValueIsEmptyList_ResultMatchesInput(self):
        value = []
        field = IterField()

        prepped = field.get_prep_value(value)
        py = field.to_python(prepped)

        self.assertEqual(value, py)
    def test_ValueIsDictWithElementsListAndDicts_ResultMatchesInput(self):
        value = {"foo": 1, "bar": [2, 3, 4], "boo": {"moo": 5}}
        field = IterField()

        prepped = field.get_prep_value(value)
        py = field.to_python(prepped)

        self.assertEqual(value, py)
    def test_ValueIsListWithElementsListAndDicts_ResultMatchesInput(self):
        value = [1, 2, 3, [4, 5, 6], {"foo": 8}]
        field = IterField()

        prepped = field.get_prep_value(value)
        py = field.to_python(prepped)

        self.assertEqual(value, py)
    def test_ValueIsDictWithElementsListAndDicts_ResultMatchesInput(self):
        value = {"foo": 1, "bar": [2, 3, 4], "boo": {"moo": 5}}
        field = IterField()

        prepped = field.get_prep_value(value)
        py = field.to_python(prepped)

        self.assertEqual(value, py)
    def test_ValueIsListWithElementsListAndDicts_ResultMatchesInput(self):
        value = [1, 2, 3, [4, 5, 6], {"foo": 8}]
        field = IterField()

        prepped = field.get_prep_value(value)
        py = field.to_python(prepped)

        self.assertEqual(value, py)
    def test_ValueIsEmptyDict_ResultMatchesInput(self):
        value = {}
        field = IterField()

        prepped = field.get_prep_value(value)
        py = field.to_python(prepped)

        self.assertEqual(value, py)
    def test_ValueIsTupleOfListsAndDictionaries_StringIsJsonRepresentationOfThatListWithNoSpaces(self):
        field = IterField()
        value = (0, {1: {2: 3}}, [4, 5, 6])

        self.assertEqual(pickle.dumps(value), field.get_prep_value(value))
    def test_ValueIsDictionaryOfElements_StringIsJsonRepresentationOfThatListWithNoSpaces(self):
        field = IterField()
        value = {1: 2, 3: 4, 5: 6}

        self.assertEqual(pickle.dumps(value), field.get_prep_value(value))
    def test_ValueIsListOfListsAndDictionaries_StringIsJsonRepresentationOfThatListWithNoSpaces(self):
        field = IterField()
        value = [[1, 2, 3], {4: 5}]

        self.assertEqual(pickle.dumps(value), field.get_prep_value(value))
    def test_ValueIsListOfElements_StringIsJsonRepresentationOfThatListWithNoSpaces(self):
        field = IterField()
        value = [1, 2, 3, 4, 5]

        self.assertEqual(pickle.dumps(value), field.get_prep_value(value))
    def test_ValueIsATuple_StringIsEmptyDict(self):
        field = IterField()
        value = (1, 2, 3)

        self.assertEqual(pickle.dumps(value), field.get_prep_value(value))
Example #12
0
    def test_ValueIsAnEmptyDictionary_StringIsEmptyDict(self):
        field = IterField()
        value = {}

        self.assertEqual(pickle.dumps(value), field.get_prep_value(value))
Example #13
0
    def test_ValueIsTupleOfListsAndDictionaries_StringIsJsonRepresentationOfThatListWithNoSpaces(
            self):
        field = IterField()
        value = (0, {1: {2: 3}}, [4, 5, 6])

        self.assertEqual(pickle.dumps(value), field.get_prep_value(value))
Example #14
0
    def test_ValueIsDictionaryOfElements_StringIsJsonRepresentationOfThatListWithNoSpaces(
            self):
        field = IterField()
        value = {1: 2, 3: 4, 5: 6}

        self.assertEqual(pickle.dumps(value), field.get_prep_value(value))
Example #15
0
    def test_ValueIsListOfListsAndDictionaries_StringIsJsonRepresentationOfThatListWithNoSpaces(
            self):
        field = IterField()
        value = [[1, 2, 3], {4: 5}]

        self.assertEqual(pickle.dumps(value), field.get_prep_value(value))
Example #16
0
    def test_ValueIsListOfElements_StringIsJsonRepresentationOfThatListWithNoSpaces(
            self):
        field = IterField()
        value = [1, 2, 3, 4, 5]

        self.assertEqual(pickle.dumps(value), field.get_prep_value(value))
Example #17
0
    def test_ValueIsATuple_StringIsEmptyDict(self):
        field = IterField()
        value = (1, 2, 3)

        self.assertEqual(pickle.dumps(value), field.get_prep_value(value))
    def test_ValueIsAnEmptyDictionary_StringIsEmptyDict(self):
        field = IterField()
        value = {}

        self.assertEqual(pickle.dumps(value), field.get_prep_value(value))
    def test_ValueIsAnEmptyList_StringIsEmptyList(self):
        field = IterField()
        value = []

        self.assertEqual(pickle.dumps(value), field.get_prep_value(value))
Example #20
0
    def test_ValueIsAnEmptyList_StringIsEmptyList(self):
        field = IterField()
        value = []

        self.assertEqual(pickle.dumps(value), field.get_prep_value(value))