Exemplo n.º 1
0
    def test_get_all_no_match(self):
        ct = ConversionTable([("pants", conv_val, conv_item),
                              ("shirt", conv_val, conv_item, True)])

        item_list = ct.get_all("belt")
        assert isinstance(item_list, list)
        assert not item_list
Exemplo n.º 2
0
    def test_get_all_no_match(self):
        ct = ConversionTable([("pants", conv_val, conv_item),
                              ("shirt", conv_val, conv_item, True)])

        l = ct.get_all("belt")
        assert isinstance(l, list)
        assert not l
Exemplo n.º 3
0
    def test_duplicate(self):
        c1 = Converter("pants", conv_val, conv_item)
        c2 = Converter("pants", conv_val, conv_item)
        c3 = Converter("shirt", conv_val, conv_item)

        ct = ConversionTable([c1, c2, c3])

        assert ct.get('pants') is c1
        item_list = ct.get_all('pants')
        assert item_list[0] is c1
        assert item_list[1] is c2

        ct.delete('pants')
        item_list = ct.get_all('pants')
        assert not item_list
        assert len(ct) == 1
        assert ct[0] is c3
Exemplo n.º 4
0
    def test_duplicate(self):
        c1 = Converter("pants", conv_val, conv_item)
        c2 = Converter("pants", conv_val, conv_item)
        c3 = Converter("shirt", conv_val, conv_item)

        ct = ConversionTable([c1, c2, c3])

        assert ct.get('pants') is c1
        l = ct.get_all('pants')
        assert l[0] is c1
        assert l[1] is c2

        ct.delete('pants')
        l = ct.get_all('pants')
        assert not l
        assert len(ct) == 1
        assert ct[0] is c3