Example #1
0
def test_1_component_dict_interface():
    palette = Palette(sample=Sample1)

    assert_dict_equal(dict(sample=Sample1), palette)
    assert_equal(len(palette), 1)
    assert_equal(palette.keys(), ['sample'])
    assert_equal(palette.values(), [Sample1])

    items = palette.items()
    assert_tuple_equal(('sample', Sample1), items[0])
Example #2
0
    def test_dict_interface(self):
        palette = Palette(sample=Sample1)

        self.assertDictEqual(dict(sample=Sample1), palette)
        self.assertEqual(len(palette), 1)
        self.assertEqual(palette.keys(), ['sample'])
        self.assertEqual(palette.values(), [Sample1])

        items = palette.items()
        self.assertTupleEqual(('sample', Sample1), items[0])
Example #3
0
def test_1_component_dict_interface():
    palette = Palette(sample=Sample1)

    assert dict(sample=Sample1) == palette
    assert len(palette) == 1
    assert list(palette.keys()) == ["sample"]
    assert list(palette.values()) == [Sample1]

    items = list(palette.items())
    assert ("sample", Sample1) == items[0]
Example #4
0
def test_2_components_dict_interface():
    palette = Palette(one=Sample1, two=Sample2)

    assert_dict_equal(dict(one=Sample1, two=Sample2), palette)
    assert_equal(len(palette), 2)

    keys = palette.keys()
    keys.sort()
    assert_list_equal(['one', 'two'], keys)

    values = palette.values()
    assert_equal(2, len(values))
    assert_true(Sample1 in values and Sample2 in values)

    items = palette.items()
    items.sort()
    assert_equal(2, len(items))
    assert_tuple_equal(('one', Sample1), items[0])
    assert_tuple_equal(('two', Sample2), items[1])
Example #5
0
    def test_dict_interface(self):
        palette = Palette(one=Sample1, two=Sample2)

        self.assertDictEqual(dict(one=Sample1, two=Sample2), palette)
        self.assertEqual(len(palette), 2)

        keys = palette.keys()
        keys.sort()
        self.assertListEqual(['one', 'two'], keys)

        values = palette.values()
        self.assertEqual(2, len(values))
        self.assertTrue(Sample1 in values and Sample2 in values)

        items = palette.items()
        items.sort()
        self.assertEqual(2, len(items))
        self.assertTupleEqual(('one', Sample1), items[0])
        self.assertTupleEqual(('two', Sample2), items[1])
Example #6
0
def test_2_components_dict_interface():
    palette = Palette(one=Sample1, two=Sample2)

    assert dict(one=Sample1, two=Sample2) == palette
    assert len(palette) == 2

    keys = list(palette.keys())
    keys.sort()
    assert ["one", "two"] == keys

    values = palette.values()
    assert 2 == len(values)
    assert Sample1 in values and Sample2 in values

    items = list(palette.items())
    items.sort()
    assert 2 == len(items)
    assert ("one", Sample1) == items[0]
    assert ("two", Sample2) == items[1]
Example #7
0
def test_2_components_dict_interface():
    palette = Palette(one=Sample1, two=Sample2)

    assert dict(one=Sample1, two=Sample2) == palette
    assert len(palette) == 2

    keys = list(palette.keys())
    keys.sort()
    assert ["one", "two"] == keys

    values = palette.values()
    assert 2 == len(values)
    assert Sample1 in values and Sample2 in values

    items = list(palette.items())
    items.sort()
    assert 2 == len(items)
    assert ("one", Sample1) == items[0]
    assert ("two", Sample2) == items[1]
Example #8
0
def test_2_components_dict_interface():
    palette = Palette(one=Sample1, two=Sample2)

    assert_dict_equal(dict(one=Sample1, two=Sample2), palette)
    assert_equal(len(palette), 2)

    keys = list(palette.keys())
    keys.sort()
    assert_list_equal(['one', 'two'], keys)

    values = palette.values()
    assert_equal(2, len(values))
    assert_true(Sample1 in values and Sample2 in values)

    items = list(palette.items())
    items.sort()
    assert_equal(2, len(items))
    assert_tuple_equal(('one', Sample1), items[0])
    assert_tuple_equal(('two', Sample2), items[1])