def test_unformat(self): prep = compiler.IdentifierPreparer(None) unformat = prep.unformat_identifiers def a_eq(have, want): if have != want: print "Wanted %s" % want print "Received %s" % have self.assert_(have == want) a_eq(unformat('foo'), ['foo']) a_eq(unformat('"foo"'), ['foo']) a_eq(unformat("'foo'"), ["'foo'"]) a_eq(unformat('foo.bar'), ['foo', 'bar']) a_eq(unformat('"foo"."bar"'), ['foo', 'bar']) a_eq(unformat('foo."bar"'), ['foo', 'bar']) a_eq(unformat('"foo".bar'), ['foo', 'bar']) a_eq(unformat('"foo"."b""a""r"."baz"'), ['foo', 'b"a"r', 'baz'])
def test_unformat(self): prep = compiler.IdentifierPreparer(default.DefaultDialect()) unformat = prep.unformat_identifiers def a_eq(have, want): if have != want: print("Wanted %s" % want) print("Received %s" % have) self.assert_(have == want) a_eq(unformat("foo"), ["foo"]) a_eq(unformat('"foo"'), ["foo"]) a_eq(unformat("'foo'"), ["'foo'"]) a_eq(unformat("foo.bar"), ["foo", "bar"]) a_eq(unformat('"foo"."bar"'), ["foo", "bar"]) a_eq(unformat('foo."bar"'), ["foo", "bar"]) a_eq(unformat('"foo".bar'), ["foo", "bar"]) a_eq(unformat('"foo"."b""a""r"."baz"'), ["foo", 'b"a"r', "baz"])