Loading openscad/libs/test/test_dict.py +32 −0 Original line number Diff line number Diff line Loading @@ -560,6 +560,38 @@ class TestKeyLookup4(BaseTestScadDict): ''' self.run_scad(scad, has_errors=True) class TestKeyLookup5(BaseTestScadDict): """ Check openscad uses fallback when provided. """ def test(self): '''Must be the only test in the class!''' scad = ''' dict = [["a",3], ["ab", 22], ["raisin", 99], ["great", 4]]; val = key_lookup("foo", dict, default=21); assert(val==21); ''' self.run_scad(scad, has_errors=False) class TestKeyLookup6(BaseTestScadDict): """ Check openscad uses ignores fallback if key exists. """ def test(self): '''Must be the only test in the class!''' scad = ''' dict = [["a",3], ["ab", 22], ["raisin", 99], ["great", 4]]; val = key_lookup("raisin", dict, default=21); assert(val==99); ''' self.run_scad(scad, has_errors=False) class TestReplace1(BaseTestScadDict): """ Check that a value can be replaced and then read and that other values are Loading Loading
openscad/libs/test/test_dict.py +32 −0 Original line number Diff line number Diff line Loading @@ -560,6 +560,38 @@ class TestKeyLookup4(BaseTestScadDict): ''' self.run_scad(scad, has_errors=True) class TestKeyLookup5(BaseTestScadDict): """ Check openscad uses fallback when provided. """ def test(self): '''Must be the only test in the class!''' scad = ''' dict = [["a",3], ["ab", 22], ["raisin", 99], ["great", 4]]; val = key_lookup("foo", dict, default=21); assert(val==21); ''' self.run_scad(scad, has_errors=False) class TestKeyLookup6(BaseTestScadDict): """ Check openscad uses ignores fallback if key exists. """ def test(self): '''Must be the only test in the class!''' scad = ''' dict = [["a",3], ["ab", 22], ["raisin", 99], ["great", 4]]; val = key_lookup("raisin", dict, default=21); assert(val==99); ''' self.run_scad(scad, has_errors=False) class TestReplace1(BaseTestScadDict): """ Check that a value can be replaced and then read and that other values are Loading