workspace
stringclasses 1
value | channel
stringclasses 1
value | sentences
stringlengths 1
3.93k
| ts
stringlengths 26
26
| user
stringlengths 2
11
| sentence_id
stringlengths 44
53
| timestamp
float64 1.5B
1.56B
| __index_level_0__
int64 0
106k
|
---|---|---|---|---|---|---|---|
pythondev
|
help
|
so you need to add in the packages you want for the desired capability
|
2019-05-22T07:49:29.012900
|
Hiroko
|
pythondev_help_Hiroko_2019-05-22T07:49:29.012900
| 1,558,511,369.0129 | 24,821 |
pythondev
|
help
|
Fine. Now back to debugging concept ?
|
2019-05-22T07:50:07.013300
|
Amparo
|
pythondev_help_Amparo_2019-05-22T07:50:07.013300
| 1,558,511,407.0133 | 24,822 |
pythondev
|
help
|
I'm asking find bug and debug . For ex) if I pass the argument to the function mean How I can check the argument received to that functions or what values come for that particular arguments etc... Like developer debugging tool.
|
2019-05-22T07:50:24.013500
|
Amparo
|
pythondev_help_Amparo_2019-05-22T07:50:24.013500
| 1,558,511,424.0135 | 24,823 |
pythondev
|
help
|
I already answered that for you :slightly_smiling_face:
|
2019-05-22T07:50:44.014200
|
Hiroko
|
pythondev_help_Hiroko_2019-05-22T07:50:44.014200
| 1,558,511,444.0142 | 24,824 |
pythondev
|
help
|
you’re using sublime
|
2019-05-22T07:50:48.014400
|
Hiroko
|
pythondev_help_Hiroko_2019-05-22T07:50:48.014400
| 1,558,511,448.0144 | 24,825 |
pythondev
|
help
|
that’s an editor, not an IDE. So if you want that, you need to install packages for that functionality
|
2019-05-22T07:51:03.015100
|
Hiroko
|
pythondev_help_Hiroko_2019-05-22T07:51:03.015100
| 1,558,511,463.0151 | 24,826 |
pythondev
|
help
|
check out <https://realpython.com/setting-up-sublime-text-3-for-full-stack-python-development/> for some good package and configuration suggestions for ST
|
2019-05-22T07:51:27.015900
|
Hiroko
|
pythondev_help_Hiroko_2019-05-22T07:51:27.015900
| 1,558,511,487.0159 | 24,827 |
pythondev
|
help
|
Fpr example in coldfusion if I dump( argument ) it will show all argument with its value in structure format. If I did abort(). then next line of any code will not excute
|
2019-05-22T07:51:36.016200
|
Amparo
|
pythondev_help_Amparo_2019-05-22T07:51:36.016200
| 1,558,511,496.0162 | 24,828 |
pythondev
|
help
|
Sure. I will take a look on your link <@Hiroko> Thank you
|
2019-05-22T07:52:39.016800
|
Amparo
|
pythondev_help_Amparo_2019-05-22T07:52:39.016800
| 1,558,511,559.0168 | 24,829 |
pythondev
|
help
|
ok, gotcha. I think you’re going to find a very different experience with non coldfusion languages
|
2019-05-22T07:52:48.017000
|
Hiroko
|
pythondev_help_Hiroko_2019-05-22T07:52:48.017000
| 1,558,511,568.017 | 24,830 |
pythondev
|
help
|
Yes :slightly_smiling_face:
|
2019-05-22T07:53:00.017500
|
Amparo
|
pythondev_help_Amparo_2019-05-22T07:53:00.017500
| 1,558,511,580.0175 | 24,831 |
pythondev
|
help
|
FWIW, I have java, c, php, javascript and python experience
|
2019-05-22T07:53:07.017700
|
Hiroko
|
pythondev_help_Hiroko_2019-05-22T07:53:07.017700
| 1,558,511,587.0177 | 24,832 |
pythondev
|
help
|
none of those languages really have similar things
|
2019-05-22T07:53:28.018300
|
Hiroko
|
pythondev_help_Hiroko_2019-05-22T07:53:28.018300
| 1,558,511,608.0183 | 24,833 |
pythondev
|
help
|
well, php has `var_dump`
|
2019-05-22T07:53:43.018800
|
Hiroko
|
pythondev_help_Hiroko_2019-05-22T07:53:43.018800
| 1,558,511,623.0188 | 24,834 |
pythondev
|
help
|
Yes you got it my point clearly
|
2019-05-22T07:54:03.019700
|
Amparo
|
pythondev_help_Amparo_2019-05-22T07:54:03.019700
| 1,558,511,643.0197 | 24,835 |
pythondev
|
help
|
you can do the same in python with `print(globals()`, and `print(locals())`
|
2019-05-22T07:54:04.019900
|
Hiroko
|
pythondev_help_Hiroko_2019-05-22T07:54:04.019900
| 1,558,511,644.0199 | 24,836 |
pythondev
|
help
|
<https://www.jetbrains.com/pycharm/download/#section=windows> you can try the community edition to see if that works for you, but you would still have to learn to use it first
|
2019-05-22T07:54:06.020000
|
Leida
|
pythondev_help_Leida_2019-05-22T07:54:06.020000
| 1,558,511,646.02 | 24,837 |
pythondev
|
help
|
So there is any way for it ?
|
2019-05-22T07:54:19.020400
|
Amparo
|
pythondev_help_Amparo_2019-05-22T07:54:19.020400
| 1,558,511,659.0204 | 24,838 |
pythondev
|
help
|
how many IDEs are there for CF?
|
2019-05-22T07:54:39.021000
|
Hiroko
|
pythondev_help_Hiroko_2019-05-22T07:54:39.021000
| 1,558,511,679.021 | 24,839 |
pythondev
|
help
|
Sublime, Vs code, coldfusion builder ( By default )
|
2019-05-22T07:55:37.021500
|
Amparo
|
pythondev_help_Amparo_2019-05-22T07:55:37.021500
| 1,558,511,737.0215 | 24,840 |
pythondev
|
help
|
So. Many. Notifications. :smile:
|
2019-05-22T07:56:31.021900
|
My
|
pythondev_help_My_2019-05-22T07:56:31.021900
| 1,558,511,791.0219 | 24,841 |
pythondev
|
help
|
you can try with vs code too <https://github.com/microsoft/vscode-recipes/tree/master/debugging%20python>
|
2019-05-22T07:56:59.022300
|
Leida
|
pythondev_help_Leida_2019-05-22T07:56:59.022300
| 1,558,511,819.0223 | 24,842 |
pythondev
|
help
|
Huh using VS code it's slow my system
|
2019-05-22T07:58:02.022800
|
Amparo
|
pythondev_help_Amparo_2019-05-22T07:58:02.022800
| 1,558,511,882.0228 | 24,843 |
pythondev
|
help
|
Even I'm having good configuration system
|
2019-05-22T07:58:13.023100
|
Amparo
|
pythondev_help_Amparo_2019-05-22T07:58:13.023100
| 1,558,511,893.0231 | 24,844 |
pythondev
|
help
|
So generally vs code take more time to load, Hang on.. etc..
|
2019-05-22T07:58:34.023600
|
Amparo
|
pythondev_help_Amparo_2019-05-22T07:58:34.023600
| 1,558,511,914.0236 | 24,845 |
pythondev
|
help
|
So I always give priority to sublime text only :slightly_smiling_face:
|
2019-05-22T07:58:52.024100
|
Amparo
|
pythondev_help_Amparo_2019-05-22T07:58:52.024100
| 1,558,511,932.0241 | 24,846 |
pythondev
|
help
|
Any feedback about my point <@Leida> <@My> <@Hiroko>
|
2019-05-22T07:59:21.024700
|
Amparo
|
pythondev_help_Amparo_2019-05-22T07:59:21.024700
| 1,558,511,961.0247 | 24,847 |
pythondev
|
help
|
if you dont use an ide which are more heavy weight then you are gonna have to put in more elbow grease to get things to work
|
2019-05-22T08:00:22.025500
|
Leida
|
pythondev_help_Leida_2019-05-22T08:00:22.025500
| 1,558,512,022.0255 | 24,848 |
pythondev
|
help
|
can be a bit of fiddling and i personally havent worked with sublime to know what needs to be done
|
2019-05-22T08:00:47.026200
|
Leida
|
pythondev_help_Leida_2019-05-22T08:00:47.026200
| 1,558,512,047.0262 | 24,849 |
pythondev
|
help
|
SO you mean IDLE is best by default ?
|
2019-05-22T08:01:05.026600
|
Amparo
|
pythondev_help_Amparo_2019-05-22T08:01:05.026600
| 1,558,512,065.0266 | 24,850 |
pythondev
|
help
|
personnally I never run code inside of sublime
|
2019-05-22T08:02:00.027400
|
My
|
pythondev_help_My_2019-05-22T08:02:00.027400
| 1,558,512,120.0274 | 24,851 |
pythondev
|
help
|
aparently it does have a debugger inbulit - never used it. Certainly not the best, but is probably relatively light weight. <https://www.cs.uky.edu/~keen/help/debug-tutorial/debug.html>
|
2019-05-22T08:02:08.027700
|
Leida
|
pythondev_help_Leida_2019-05-22T08:02:08.027700
| 1,558,512,128.0277 | 24,852 |
pythondev
|
help
|
I execute it in a terminal
|
2019-05-22T08:02:12.027900
|
My
|
pythondev_help_My_2019-05-22T08:02:12.027900
| 1,558,512,132.0279 | 24,853 |
pythondev
|
help
|
IDLE is pretty crappy, FWIW
|
2019-05-22T08:02:25.028400
|
Hiroko
|
pythondev_help_Hiroko_2019-05-22T08:02:25.028400
| 1,558,512,145.0284 | 24,854 |
pythondev
|
help
|
if I want to debug, I plug a debugger around the breaking point :shrug:
|
2019-05-22T08:02:47.029000
|
My
|
pythondev_help_My_2019-05-22T08:02:47.029000
| 1,558,512,167.029 | 24,855 |
pythondev
|
help
|
I use `import pdb; pdb.set_trace()` because I keep forgetting `traceback()` exists
|
2019-05-22T08:03:21.029400
|
My
|
pythondev_help_My_2019-05-22T08:03:21.029400
| 1,558,512,201.0294 | 24,856 |
pythondev
|
help
|
if I type 'git status' on the terminal in Pycharm, i get different results inside of the same folder if I use 'git status' on WSL (bash for windows)
|
2019-05-22T08:04:37.030400
|
Alvina
|
pythondev_help_Alvina_2019-05-22T08:04:37.030400
| 1,558,512,277.0304 | 24,857 |
pythondev
|
help
|
with python 3.7, `breakpoint`
|
2019-05-22T08:04:42.030700
|
Hiroko
|
pythondev_help_Hiroko_2019-05-22T08:04:42.030700
| 1,558,512,282.0307 | 24,858 |
pythondev
|
help
|
import pdb; pdb.set_trace,traceback(),breakpoint these are really looking good. Thanks for you all time on my chat Mr <@Hiroko> Mr <@Leida> Mr <@My>
|
2019-05-22T08:05:58.031900
|
Amparo
|
pythondev_help_Amparo_2019-05-22T08:05:58.031900
| 1,558,512,358.0319 | 24,859 |
pythondev
|
help
|
I need some time to go through and study all then only I can ask some meaningful questions . I hope
|
2019-05-22T08:06:31.032500
|
Amparo
|
pythondev_help_Amparo_2019-05-22T08:06:31.032500
| 1,558,512,391.0325 | 24,860 |
pythondev
|
help
|
good luck :stuck_out_tongue:
|
2019-05-22T08:06:42.032700
|
Leida
|
pythondev_help_Leida_2019-05-22T08:06:42.032700
| 1,558,512,402.0327 | 24,861 |
pythondev
|
help
|
I am on the same master branch and the remote origin is the same
|
2019-05-22T08:06:59.033000
|
Alvina
|
pythondev_help_Alvina_2019-05-22T08:06:59.033000
| 1,558,512,419.033 | 24,862 |
pythondev
|
help
|
and I am physically in the same folder
|
2019-05-22T08:07:08.033300
|
Alvina
|
pythondev_help_Alvina_2019-05-22T08:07:08.033300
| 1,558,512,428.0333 | 24,863 |
pythondev
|
help
|
yeah sorry, that's the one I meant
|
2019-05-22T08:07:52.033400
|
My
|
pythondev_help_My_2019-05-22T08:07:52.033400
| 1,558,512,472.0334 | 24,864 |
pythondev
|
help
|
<@Amparo> `traceback` is a mistake, I meant breakpoint :slightly_smiling_face:
|
2019-05-22T08:08:48.033600
|
My
|
pythondev_help_My_2019-05-22T08:08:48.033600
| 1,558,512,528.0336 | 24,865 |
pythondev
|
help
|
Idcey can you maybe tell us what the difference is between the two?
|
2019-05-22T08:12:58.034900
|
Leida
|
pythondev_help_Leida_2019-05-22T08:12:58.034900
| 1,558,512,778.0349 | 24,866 |
pythondev
|
help
|
sure you’re using the same git?
|
2019-05-22T08:14:03.035200
|
Hiroko
|
pythondev_help_Hiroko_2019-05-22T08:14:03.035200
| 1,558,512,843.0352 | 24,867 |
pythondev
|
help
|
what does `which git` return in both?
|
2019-05-22T08:14:12.035600
|
Hiroko
|
pythondev_help_Hiroko_2019-05-22T08:14:12.035600
| 1,558,512,852.0356 | 24,868 |
pythondev
|
help
|
no - one is on windows (C: drive) and the other is /usr/bin/git
|
2019-05-22T08:38:03.036000
|
Alvina
|
pythondev_help_Alvina_2019-05-22T08:38:03.036000
| 1,558,514,283.036 | 24,869 |
pythondev
|
help
|
did not realize that would matter - I thought it used the .git subfolder to keep track
|
2019-05-22T08:38:23.036500
|
Alvina
|
pythondev_help_Alvina_2019-05-22T08:38:23.036500
| 1,558,514,303.0365 | 24,870 |
pythondev
|
help
|
let me switch pycharm to use the /usr/bin WSL path instead to see if that clears things up
|
2019-05-22T08:38:47.037000
|
Alvina
|
pythondev_help_Alvina_2019-05-22T08:38:47.037000
| 1,558,514,327.037 | 24,871 |
pythondev
|
help
|
```>>> some_string = "wtf"
>>> some_dict = {}
>>> for some_dict[i], i in enumerate(some_string):
... pass
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'i' is not defined
>>> for i, some_dict[i] in enumerate(some_string):
... pass
...
>>> some_dict
{0: 'w', 1: 't', 2: 'f'}
>>> for some_dict[i], i in enumerate(some_string):
... pass
...
>>> some_dict
{0: 'w', 1: 't', 2: 0, 'w': 1, 't': 2}```
|
2019-05-22T09:34:30.038400
|
Leida
|
pythondev_help_Leida_2019-05-22T09:34:30.038400
| 1,558,517,670.0384 | 24,872 |
pythondev
|
help
|
for loop seems to internally keep its variables over several calls
|
2019-05-22T09:35:08.038900
|
Leida
|
pythondev_help_Leida_2019-05-22T09:35:08.038900
| 1,558,517,708.0389 | 24,873 |
pythondev
|
help
|
first and third for loop are identical yet first one returns an error while the third one does not
|
2019-05-22T09:35:31.039500
|
Leida
|
pythondev_help_Leida_2019-05-22T09:35:31.039500
| 1,558,517,731.0395 | 24,874 |
pythondev
|
help
|
ah, `enumerate` returns a tuple of `index, value`
|
2019-05-22T09:39:13.040200
|
Hiroko
|
pythondev_help_Hiroko_2019-05-22T09:39:13.040200
| 1,558,517,953.0402 | 24,875 |
pythondev
|
help
|
In python, `for` loops do not create a new scope
|
2019-05-22T09:39:15.040400
|
Chester
|
pythondev_help_Chester_2019-05-22T09:39:15.040400
| 1,558,517,955.0404 | 24,876 |
pythondev
|
help
|
Same for `if` and `with`
|
2019-05-22T09:39:31.041200
|
Chester
|
pythondev_help_Chester_2019-05-22T09:39:31.041200
| 1,558,517,971.0412 | 24,877 |
pythondev
|
help
|
ah so the `i` is in outer scope?
|
2019-05-22T09:39:35.041400
|
Leida
|
pythondev_help_Leida_2019-05-22T09:39:35.041400
| 1,558,517,975.0414 | 24,878 |
pythondev
|
help
|
Exactly
|
2019-05-22T09:39:40.041700
|
Chester
|
pythondev_help_Chester_2019-05-22T09:39:40.041700
| 1,558,517,980.0417 | 24,879 |
pythondev
|
help
|
It's a very convenient little feature allowing us to do something like
```
for item in collection:
do_stuff(item)
do_more_stuff(item)
if some_condition:
break
# `item` contains either the last element, or the one which broke the loop
```
|
2019-05-22T09:41:17.044200
|
Chester
|
pythondev_help_Chester_2019-05-22T09:41:17.044200
| 1,558,518,077.0442 | 24,880 |
pythondev
|
help
|
second loop is to demonstrate that the tuple is unpacked sequentially making you able to use the index for the dict, which is interesting
|
2019-05-22T09:41:21.044300
|
Leida
|
pythondev_help_Leida_2019-05-22T09:41:21.044300
| 1,558,518,081.0443 | 24,881 |
pythondev
|
help
|
oh useful!
|
2019-05-22T09:41:51.044600
|
Leida
|
pythondev_help_Leida_2019-05-22T09:41:51.044600
| 1,558,518,111.0446 | 24,882 |
pythondev
|
help
|
Hi guys, how can i send extra data to the serializer even when the model does not need it?
|
2019-05-22T09:44:44.045100
|
Nanci
|
pythondev_help_Nanci_2019-05-22T09:44:44.045100
| 1,558,518,284.0451 | 24,883 |
pythondev
|
help
|
I have a form that takes in files that can be of varying filename nomenclature (eg. lastname_firstname.jpg, firstname_lastname.jpg, id_lastname.jpg, etc.) Can anybody give any reccomendations regarding the best (flexible + customizable) way to allow the user to select their prefered filename nomenclature?
|
2019-05-22T11:49:38.047700
|
Mariah
|
pythondev_help_Mariah_2019-05-22T11:49:38.047700
| 1,558,525,778.0477 | 24,884 |
pythondev
|
help
|
Hey folks, I am having some trouble with `nginx` and `gunicorn` on Ubuntu 18. From what I can tell, `gunicorn` is being bypassed entirely and nginx is getting all the requests. I am working on a Vagrant VM at the moment because I am on Mac, and trying to follow the instructions from here ( <https://www.cloudbooklet.com/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-18-04-in-google-cloud/> ). Anyone interested in giving me a hand in solving this?
|
2019-05-22T12:53:12.048400
|
Linette
|
pythondev_help_Linette_2019-05-22T12:53:12.048400
| 1,558,529,592.0484 | 24,885 |
pythondev
|
help
|
if nginx is getting all the requests that’s a good sign.
|
2019-05-22T12:58:31.049000
|
Eliana
|
pythondev_help_Eliana_2019-05-22T12:58:31.049000
| 1,558,529,911.049 | 24,886 |
pythondev
|
help
|
Hi!!!!
|
2019-05-22T13:00:06.049200
|
Linette
|
pythondev_help_Linette_2019-05-22T13:00:06.049200
| 1,558,530,006.0492 | 24,887 |
pythondev
|
help
|
It's been a long time, <@Eliana>! I have re-gifted your advice on Ansible to many, many people since you last gave me a hand!
|
2019-05-22T13:01:45.050000
|
Linette
|
pythondev_help_Linette_2019-05-22T13:01:45.050000
| 1,558,530,105.05 | 24,888 |
pythondev
|
help
|
yea, that was a couple years ago i think. hopefully, it stood to be good advice :sweat_smile: i don’t do much ansible these days. how have ya been? Still in Austin?
|
2019-05-22T13:03:08.050400
|
Eliana
|
pythondev_help_Eliana_2019-05-22T13:03:08.050400
| 1,558,530,188.0504 | 24,889 |
pythondev
|
help
|
Indeed!
|
2019-05-22T13:04:14.050700
|
Linette
|
pythondev_help_Linette_2019-05-22T13:04:14.050700
| 1,558,530,254.0507 | 24,890 |
pythondev
|
help
|
Would you mind taking a look at this with me so that we can see if your advice skills are still current? :smile:
|
2019-05-22T13:08:14.050900
|
Linette
|
pythondev_help_Linette_2019-05-22T13:08:14.050900
| 1,558,530,494.0509 | 24,891 |
pythondev
|
help
|
<@Lean> :taco: for <https://github.com/stripe/react-stripe-elements/issues/179#issuecomment-413313797>
|
2019-05-22T13:08:48.051500
|
Sterling
|
pythondev_help_Sterling_2019-05-22T13:08:48.051500
| 1,558,530,528.0515 | 24,892 |
pythondev
|
help
|
Does someone knows how to add the included tag in Django Rest Api JSON API?
|
2019-05-22T13:24:47.052500
|
Nanci
|
pythondev_help_Nanci_2019-05-22T13:24:47.052500
| 1,558,531,487.0525 | 24,893 |
pythondev
|
help
|
```
title = serializers.CharField(max_length=50, required=True)
description = serializers.CharField(required=True)
included_serializers = {
'user': UserSerializer,
'resource': ResourceSerializer
}
def validate(self, data):
url = self.context.get('request').data['url']
tags = self.context.get('request').data['tags']
response = requests.get(url)
user = User.objects.get_or_create(email = '<mailto:[email protected]|[email protected]>', name = 'John Doe')[0]
soup = BeautifulSoup(response.content, 'html.parser')
og_title = soup.find('meta', property='og:title')['content']
og_description = soup.find('meta', property='og:description')['content']
og_img = soup.find('meta', property='og:image')['content']
resource = Resource.objects.create(url = url, title = og_title, description = og_description, image_url = og_img)
resource.tags.set(tags)
new_data = OrderedDict([('resource', resource), ('title', data['title']), ('description', data['description']), ('user', user)])
return new_data
class JSONAPIMeta:
included_resources = ['resource', 'user']
class Meta:
model = Share
fields = ('title', 'description')
```
I currently have this code working, but not displaying the included
|
2019-05-22T13:25:14.053100
|
Nanci
|
pythondev_help_Nanci_2019-05-22T13:25:14.053100
| 1,558,531,514.0531 | 24,894 |
pythondev
|
help
|
haha, let’s see.. so it seems you were able to get nginx working. the missing piece is nginx routing the requests to gunicorn.
|
2019-05-22T13:47:11.053200
|
Eliana
|
pythondev_help_Eliana_2019-05-22T13:47:11.053200
| 1,558,532,831.0532 | 24,895 |
pythondev
|
help
|
or gunicorn is not starting up.
|
2019-05-22T13:47:52.053400
|
Eliana
|
pythondev_help_Eliana_2019-05-22T13:47:52.053400
| 1,558,532,872.0534 | 24,896 |
pythondev
|
help
|
how are you starting gunicorn? are you using systemd?
|
2019-05-22T13:48:02.053600
|
Eliana
|
pythondev_help_Eliana_2019-05-22T13:48:02.053600
| 1,558,532,882.0536 | 24,897 |
pythondev
|
help
|
ok yep i see it the doc you posted.
|
2019-05-22T13:48:27.053800
|
Eliana
|
pythondev_help_Eliana_2019-05-22T13:48:27.053800
| 1,558,532,907.0538 | 24,898 |
pythondev
|
help
|
i would checkout those logs to make sure the app is actually starting up.
|
2019-05-22T13:48:43.054000
|
Eliana
|
pythondev_help_Eliana_2019-05-22T13:48:43.054000
| 1,558,532,923.054 | 24,899 |
pythondev
|
help
|
small world :smile:
|
2019-05-22T14:27:00.054200
|
Jimmy
|
pythondev_help_Jimmy_2019-05-22T14:27:00.054200
| 1,558,535,220.0542 | 24,900 |
pythondev
|
help
|
MAGIC: rebooting the computer made it work. Not the VM, but the computer.
|
2019-05-22T14:37:49.054400
|
Linette
|
pythondev_help_Linette_2019-05-22T14:37:49.054400
| 1,558,535,869.0544 | 24,901 |
pythondev
|
help
|
it’s like i say, “when in doubt, reboot out”
|
2019-05-22T14:39:44.054600
|
Eliana
|
pythondev_help_Eliana_2019-05-22T14:39:44.054600
| 1,558,535,984.0546 | 24,902 |
pythondev
|
help
|
Hello,
Have anybody unittested - sqlalchemy? I have a case similar to here: <https://stackoverflow.com/questions/44539816/real-unit-testing-of-sqlalchemy-in-flask>
- I think the answer is great - I would say exactly the same…
Before seeing it I took approach with mocking necessary objects. I hit the wall when I got the the part of code that creates the query part in `filter`:
```
... _and(my_table.columns.datetime >= datetime(2018, 1, 1))
```
MagicMocks are not comparable :slightly_smiling_face:
I’m also thinking of changing the approach and using something like `betamax` for db - is there a library like that for sqlalchemy?
|
2019-05-22T15:55:48.061100
|
Gisela
|
pythondev_help_Gisela_2019-05-22T15:55:48.061100
| 1,558,540,548.0611 | 24,903 |
pythondev
|
help
|
are you trying to mock the deep behavior of SQLAlchemy itself?
|
2019-05-22T16:26:05.061700
|
Karoline
|
pythondev_help_Karoline_2019-05-22T16:26:05.061700
| 1,558,542,365.0617 | 24,904 |
pythondev
|
help
|
I think the best approach is going to be a mix of things though - isolating your database access and accessing it through an interface as is mentioned in #4 in the accepted answer there is good for testing most of your code, then you can just replace that interface.
|
2019-05-22T16:29:25.063700
|
Karoline
|
pythondev_help_Karoline_2019-05-22T16:29:25.063700
| 1,558,542,565.0637 | 24,905 |
pythondev
|
help
|
then when doing fuller integration tests, there's no replacement for a real database in my opinion.
|
2019-05-22T16:29:43.064100
|
Karoline
|
pythondev_help_Karoline_2019-05-22T16:29:43.064100
| 1,558,542,583.0641 | 24,906 |
pythondev
|
help
|
test against the version of the db you deploy against.
|
2019-05-22T16:29:54.064400
|
Karoline
|
pythondev_help_Karoline_2019-05-22T16:29:54.064400
| 1,558,542,594.0644 | 24,907 |
pythondev
|
help
|
basically the class is a simple client working with defined interface
|
2019-05-22T16:31:08.065600
|
Gisela
|
pythondev_help_Gisela_2019-05-22T16:31:08.065600
| 1,558,542,668.0656 | 24,908 |
pythondev
|
help
|
I just didn’t want to skip it from coverage
|
2019-05-22T16:31:20.066000
|
Gisela
|
pythondev_help_Gisela_2019-05-22T16:31:20.066000
| 1,558,542,680.066 | 24,909 |
pythondev
|
help
|
if it's a simple client gluing together calls to a db, honestly the only value you'll really get form testing it will be testing it against a real db.
|
2019-05-22T16:33:33.067800
|
Karoline
|
pythondev_help_Karoline_2019-05-22T16:33:33.067800
| 1,558,542,813.0678 | 24,910 |
pythondev
|
help
|
what I wanted to achieve is to test if two queries in the method were called
|
2019-05-22T16:34:54.069100
|
Gisela
|
pythondev_help_Gisela_2019-05-22T16:34:54.069100
| 1,558,542,894.0691 | 24,911 |
pythondev
|
help
|
I know it’s simple test, that could’ve been covered probably by testing with test db instance, I just want to know how to test properly as an unittest - more for learning reasons - I just don’t like the idea of “it cannot be unittested”
|
2019-05-22T16:36:28.070800
|
Gisela
|
pythondev_help_Gisela_2019-05-22T16:36:28.070800
| 1,558,542,988.0708 | 24,912 |
pythondev
|
help
|
you can mock it as you've said. not sure how much value there is there though, really.
|
2019-05-22T16:38:31.072800
|
Karoline
|
pythondev_help_Karoline_2019-05-22T16:38:31.072800
| 1,558,543,111.0728 | 24,913 |
pythondev
|
help
|
with that version of testing there’s still problem of the comparison of mocks
|
2019-05-22T16:39:14.073600
|
Gisela
|
pythondev_help_Gisela_2019-05-22T16:39:14.073600
| 1,558,543,154.0736 | 24,914 |
pythondev
|
help
|
let’s call it academic reason :wink:
|
2019-05-22T16:39:31.074000
|
Gisela
|
pythondev_help_Gisela_2019-05-22T16:39:31.074000
| 1,558,543,171.074 | 24,915 |
pythondev
|
help
|
the problem is in the deeper magic of sqlalchemy (how it creates queries and `compare`) - I would have to add it to mocked objects, and that’s too much…
|
2019-05-22T16:41:39.076100
|
Gisela
|
pythondev_help_Gisela_2019-05-22T16:41:39.076100
| 1,558,543,299.0761 | 24,916 |
pythondev
|
help
|
oh - I think see, sorry, I see you had a more concrete issue, I thought you were more speaking generally.
|
2019-05-22T16:42:21.076500
|
Karoline
|
pythondev_help_Karoline_2019-05-22T16:42:21.076500
| 1,558,543,341.0765 | 24,917 |
pythondev
|
help
|
you can override `__eq__`
|
2019-05-22T16:42:49.077000
|
Karoline
|
pythondev_help_Karoline_2019-05-22T16:42:49.077000
| 1,558,543,369.077 | 24,918 |
pythondev
|
help
|
on the mocked object, to return True
|
2019-05-22T16:42:58.077600
|
Karoline
|
pythondev_help_Karoline_2019-05-22T16:42:58.077600
| 1,558,543,378.0776 | 24,919 |
pythondev
|
help
|
tried to do that with `__le__`, to `__gt__`
|
2019-05-22T16:43:20.078400
|
Gisela
|
pythondev_help_Gisela_2019-05-22T16:43:20.078400
| 1,558,543,400.0784 | 24,920 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.