Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable partial match warnings when running test.data.table #3664

Closed
vlulla opened this issue Jun 26, 2019 · 2 comments
Closed

Disable partial match warnings when running test.data.table #3664

vlulla opened this issue Jun 26, 2019 · 2 comments
Milestone

Comments

@vlulla
Copy link
Contributor

vlulla commented Jun 26, 2019

Since R is such a dynamic and permissive language I often find it hard to spot bugs that are result of my poor typing skills. So, to help myself I set the following options, along with others, in my .Rprofile file: options(warnPartialMatchArgs=TRUE, warnPartialMatchAttr=TRUE,warnPartialMatchDollar=TRUE). Recently, I have gotten interested in writing tests for R code and I was aware that data.table has extensive testing so I started learning it to get a little feel for it. So, I tried running the test.data.table() function today. After my amazement at the thoroughness of the testing used by data.table subsided I realized that it reported that there were some errors. However, after a little bit of digging about I realized that it was from my options settings! So, is it possible to modify the test.data.table() function to check if these options are set before running the tests? And, it would be awesome if the function disabled these options while the tests are running and then reset the options to original ones. Just fyi, I use Patrick Burns's withOptions function to temporarily turn off these functions for running the test.data.table function.

Currently, I do (using Patrick Burns's withOptions functions)

withOptions(list(warnPartialMatchArgs=F,warnPartialMatchAttr=F,warnPartialMatchDollar=F), test.data.table())

But it would be awesome if I could just do

test.data.table()
@MichaelChirico
Copy link
Member

MichaelChirico commented Jun 26, 2019

you're correct test.data.table shouldn't interact with your personal options. could you please report which tests are failing? copy-pasting the full test.data.table() output would be fine. thanks for reporting!

especially, IIUC partial match for attr is something we try to avoid internally, so you may have helped to spot some efficiency improvements as well!

@vlulla
Copy link
Contributor Author

vlulla commented Jun 27, 2019

Here's what I see in my session (with lots of lines about test running elided):

> library("data.table")
>
> test.data.table()
Running /Library/Frameworks/R.framework/Versions/3.6/Resources/library/data.table/tests/tests.Rraw
...
Running test id 169      Test 169 produced 5 warnings but expected 0
Expected:
Observed: partial match of 'coef' to 'coefficients'
Observed: partial match of 'coef' to 'coefficients'
Observed: partial match of 'coef' to 'coefficients'
Observed: partial match of 'coef' to 'coefficients'
Observed: partial match of 'coef' to 'coefficients'
...
Running test id 1561.1      Test 1561.1 produced 1 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'

Running test id 1561.2      Test 1561.2 produced 1 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'

Running test id 1561.3      Test 1561.3 produced 1 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'

Running test id 1561.4      Test 1561.4 produced 1 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'

Running test id 1561.5      Test 1561.5 produced 1 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'

Running test id 1561.6      Test 1561.6 produced 1 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
...
Running test id 1613.13      Test 1613.13 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'
...
Running test id 1613.15      Test 1613.15 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1613.16      Test 1613.16 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1613.17      Test 1613.17 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1613.18      Test 1613.18 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1613.19      
Running test id 1613.2      Test 1613.2 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1613.21      Test 1613.21 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

...
Running test id 1613.445      Test 1613.445 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1613.45      Test 1613.45 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1613.46      Test 1613.46 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'
...
Running test id 1613.51      Test 1613.51 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1613.52      Test 1613.52 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1613.53      Test 1613.53 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'
...
Running test id 1613.5422      Test 1613.542 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'
...
Running test id 1613.5522      Test 1613.552 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'
...
Running test id 1613.565      Test 1613.565 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1613.566      Test 1613.566 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1613.567      Test 1613.567 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'
...
Running test id 1626.2      Test 1626.2 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1626.3      
Running test id 1626.4      Test 1626.4 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'
...
Running test id 1626.9      Test 1626.9 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1626.1      
Running test id 1626.11      Test 1626.11 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'
...
Running test id 1626.16      Test 1626.16 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1626.17      
Running test id 1626.18      Test 1626.18 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1626.19      
Running test id 1626.2      
Running test id 1626.21      
Running test id 1626.22      
Running test id 1626.23      
Running test id 1626.24      
Running test id 1626.25      Test 1626.25 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1626.26      
Running test id 1626.27      Test 1626.27 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1626.28      
Running test id 1626.29      Test 1626.29 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1626.3      
Running test id 1626.31      Test 1626.31 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1626.32      
Running test id 1626.33      Test 1626.33 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1626.34      
Running test id 1626.35      
Running test id 1626.36      
Running test id 1626.37      Test 1626.37 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1626.38      
Running test id 1626.39      Test 1626.39 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1626.4      
Running test id 1626.41      Test 1626.41 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1626.42      
Running test id 1626.43      Test 1626.43 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1626.44      
Running test id 1626.45      Test 1626.45 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'
...
Running test id 1626.63      Test 1626.63 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1626.63      
Running test id 1626.64      Test 1626.64 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'
... 
Running test id 1626.68      Test 1626.68 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1626.69      
Running test id 1626.7      Test 1626.7 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'

Running test id 1626.71      
Running test id 1626.72      Test 1626.72 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'
...
Running test id 1626.76      Test 1626.76 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'
...
Running test id 1667.1      Test 1667.1 produced 1 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
...
Running test id 1969.4      Test 1969.4 produced 2 warnings but expected 0
Expected:
Observed: partial match of 'start' to 'starts'
Observed: partial match of 'start' to 'starts'
...
10 longest running tests took 27s (44% of 60s)
      ID  time nTest
 1: 1874 4.069     5
 2: 1438 3.719   738
 3: 1888 3.458     9
 4: 1650 3.339    91
 5: 1648 2.610    91
 6: 1652 2.556    91
 7: 1223 2.204   728
 8: 1848 1.905     1
 9: 1835 1.750     1
10: 1253 1.623   485

Error in test.data.table() :
  49 errors out of 8567 in 00:01:00 elapsed (00:01:31 cpu) on Wed Jun 26 20:39:02 2019. [endian==little, sizeof(long double)==16, sizeof(pointer)==8, TZ=America/New_York, locale='en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8', l10n_info()='MBCS=TRUE; UTF-8=TRUE; Latin-1=FALSE', getDTthreads()='omp_get_num_procs()==4; R_DATATABLE_NUM_PROCS_PERCENT=="" (default 50); R_DATATABLE_NUM_THREADS==""; omp_get_thread_limit()==2147483647; omp_get_max_threads()==4; OMP_THREAD_LIMIT==""; OMP_NUM_THREADS==""; data.table is using 2 threads. This is set on startup, and by setDTthreads(). See ?setDTthreads.; RestoreAfterFork==true']. Search tests/tests.Rraw for test numbers: 169, 1561.1, 1561.2, 1561.3, 1561.4, 1561.5, 1561.6, 1613.13, 1613.15, 1613.16, 1613.17, 1613.18, 1613.2, 1613.21, 1613.445, 1613.45, 1613.46, 1613.51, 1613.52, 1613.53, 1613.5422, 1613.5522, 1613.565, 1613.566, 1613.567, 1626.2, 1626.4, 1626.9, 1626.11, 1626.16, 1626.18, 1626.25, 1626.27, 1626.29, 1626.31,
Execution halted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants