Diogo Simões has proposed merging lp:~diogo-simoes89/zorba/DC-conversion-tests 
into lp:zorba/data-cleaning-module.

Requested reviews:
  Zorba Coders (zorba-coders)

For more details, see:
https://code.launchpad.net/~diogo-simoes89/zorba/DC-conversion-tests/+merge/91599

New changes in the tests of conversion module:
- address-from-phone
- address-from-user
- phone-from-address
- phone-from-user
- user-from-address
- user-from-phone

These changes support variations of the webservices results
-- 
https://code.launchpad.net/~diogo-simoes89/zorba/DC-conversion-tests/+merge/91599
Your team Zorba Coders is requested to review the proposed merge of 
lp:~diogo-simoes89/zorba/DC-conversion-tests into lp:zorba/data-cleaning-module.
=== modified file 'test/Queries/data-cleaning/conversion/address-from-phone.xq'
--- test/Queries/data-cleaning/conversion/address-from-phone.xq	2012-01-26 23:17:06 +0000
+++ test/Queries/data-cleaning/conversion/address-from-phone.xq	2012-02-06 00:17:18 +0000
@@ -1,8 +1,8 @@
 import module namespace conversion = "http://www.zorba-xquery.com/modules/data-cleaning/conversion";;
 
-let $arg := conversion:address-from-phone('8654582358')
+let $arg := conversion:address-from-phone('8654582358')[1]
 let $result :=
-  if(exists($arg) or empty($arg))
+  if(matches($arg, "([0-9]*[ ][A-Z]*[a-z]*)*") and not(matches($arg, "invalid")))
   then 'OK'
   else 'NOT OK'
 return $result

=== modified file 'test/Queries/data-cleaning/conversion/address-from-user.xq'
--- test/Queries/data-cleaning/conversion/address-from-user.xq	2012-01-26 23:17:06 +0000
+++ test/Queries/data-cleaning/conversion/address-from-user.xq	2012-02-06 00:17:18 +0000
@@ -1,8 +1,8 @@
 import module namespace conversion = "http://www.zorba-xquery.com/modules/data-cleaning/conversion";;
 
-let $arg := conversion:address-from-user('Maria Lurdes')
+let $arg := conversion:address-from-user('Maria Lurdes')[1]
 let $result :=
-  if(exists($arg) or empty($arg))
+  if(matches($arg, "([0-9]*[ ][A-Z]*[a-z]*)*") and not(matches($arg, "invalid")))
   then 'OK'
   else 'NOT OK'
 return $result

=== modified file 'test/Queries/data-cleaning/conversion/phone-from-address.xq'
--- test/Queries/data-cleaning/conversion/phone-from-address.xq	2012-01-26 23:17:06 +0000
+++ test/Queries/data-cleaning/conversion/phone-from-address.xq	2012-02-06 00:17:18 +0000
@@ -1,8 +1,8 @@
 import module namespace conversion = "http://www.zorba-xquery.com/modules/data-cleaning/conversion";;
 
-let $arg := conversion:phone-from-address('5655 E Gaskill Rd, Willcox, AZ, US')
+let $arg := conversion:phone-from-address('5655 E Gaskill Rd, Willcox, AZ, US')[1]
 let $result :=
-  if(exists($arg) or empty($arg))
+  if(matches($arg, "(\([0-9]{3}\) [0-9]{3}\-[0-9]{4})*") and not(matches($arg, "invalid")))
   then 'OK'
   else 'NOT OK'
 return $result

=== modified file 'test/Queries/data-cleaning/conversion/phone-from-user.xq'
--- test/Queries/data-cleaning/conversion/phone-from-user.xq	2012-01-26 23:17:06 +0000
+++ test/Queries/data-cleaning/conversion/phone-from-user.xq	2012-02-06 00:17:18 +0000
@@ -1,8 +1,8 @@
 import module namespace conversion = "http://www.zorba-xquery.com/modules/data-cleaning/conversion";;
 
-let $arg := conversion:phone-from-user ('Maria Lurdes')
+let $arg := conversion:phone-from-user ('Maria Lurdes')[1]
 let $result :=
-  if(exists($arg) or empty($arg))
+  if(matches($arg, "(\([0-9]{3}\) [0-9]{3}\-[0-9]{4})*") and not(matches($arg, "invalid")))
   then 'OK'
   else 'NOT OK'
 return $result

=== modified file 'test/Queries/data-cleaning/conversion/user-from-address.xq'
--- test/Queries/data-cleaning/conversion/user-from-address.xq	2012-01-26 23:17:06 +0000
+++ test/Queries/data-cleaning/conversion/user-from-address.xq	2012-02-06 00:17:18 +0000
@@ -1,8 +1,8 @@
 import module namespace conversion = "http://www.zorba-xquery.com/modules/data-cleaning/conversion";;
 
-let $arg := conversion:user-from-address('5655 E Gaskill Rd, Willcox, AZ, US')
+let $arg := conversion:user-from-address('5655 E Gaskill Rd, Willcox, AZ, US')[1]
 let $result :=
-  if(exists($arg) or empty($arg))
+  if(matches($arg, "([0-9]|[a-z]|[A-Z])*") and not(matches($arg, "invalid")))
   then 'OK'
   else 'NOT OK'
 return $result

=== modified file 'test/Queries/data-cleaning/conversion/user-from-phone.xq'
--- test/Queries/data-cleaning/conversion/user-from-phone.xq	2012-01-26 23:17:06 +0000
+++ test/Queries/data-cleaning/conversion/user-from-phone.xq	2012-02-06 00:17:18 +0000
@@ -1,8 +1,8 @@
 import module namespace conversion = "http://www.zorba-xquery.com/modules/data-cleaning/conversion";;
 
-let $arg := conversion:user-from-phone ('8654582358')
+let $arg := conversion:user-from-phone ('8654582358')[1]
 let $result :=
-  if(exists($arg) or empty($arg))
+  if(matches($arg, "([0-9]|[a-z]|[A-Z])*") and not(matches($arg, "invalid")))
   then 'OK'
   else 'NOT OK'
 return $result

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to