def test_items(self):
        d = CuteSleekValueDict(null_callback)
        self.assertEqual(list(d.items()), [])

        d = CuteSleekValueDict(null_callback, {1: 2})
        self.assertEqual(list(d.items()), [(1, 2)])

        self.assertRaises(TypeError, d.items, None)
Пример #2
0
    def test_items(self):
        d = CuteSleekValueDict(null_callback)
        self.assertEqual(d.items(), [])

        d = CuteSleekValueDict(null_callback, {1: 2})
        self.assertEqual(d.items(), [(1, 2)])

        self.assertRaises(TypeError, d.items, None)
Пример #3
0
def test_none():
    '''Test that `CuteSleekValueDict` can handle a value of `None`.'''

    d = {
        1: None,
        2: None,
        (1,): None,
        (1, (1,)): None,
        sum: None,
        None: None
    }
    
    csvd = CuteSleekValueDict(
        counter,
        d
    )
    

    assert sequence_tools.are_equal_regardless_of_order(list(csvd.keys()),
                                                        list(d.keys()))
    
    assert sequence_tools.are_equal_regardless_of_order(list(csvd.values()),
                                                        list(d.values()))
    
    assert sequence_tools.are_equal_regardless_of_order(list(csvd.items()),
                                                        list(d.items()))
    

    for key in csvd.keys():
        assert key in csvd
        assert csvd[key] is None
Пример #4
0
def test_none():
    '''Test that `CuteSleekValueDict` can handle a value of `None`.'''

    d = {
        1: None,
        2: None,
        (1, ): None,
        (1, (1, )): None,
        sum: None,
        None: None
    }

    csvd = CuteSleekValueDict(counter, d)

    assert sequence_tools.are_equal_regardless_of_order(csvd.keys(), d.keys())

    assert sequence_tools.are_equal_regardless_of_order(
        csvd.values(), d.values())

    assert sequence_tools.are_equal_regardless_of_order(
        csvd.items(), d.items())

    for key in csvd.iterkeys():
        assert key in csvd
        assert csvd[key] is None