Val
so from the above how can i achieve this from the instrction
Val
thanks but can u please do a little explanation
Bagdat
thanks but can u please do a little explanation
Method have one variable "name" witch has default value "there". When you call method without args , the variable will use default value. If you pass args, default value will be overwritten and variable will have new value
Val
Val
import unittest;
class Test(unittest.TestCase):
def test_returns_tuple(self):
isogram = is_isogram('abolishment')
self.assertIsInstance(isogram, tuple, msg='Does not return a tuple')
def test_checks_for_isograms(self):
word = 'abolishment'
self.assertEqual(
is_isogram(word),
(word, True),
msg="Isogram word, '{}' not detected correctly".format(word)
)
def test_returns_false_for_nonisograms(self):
word = 'alphabet'
self.assertEqual(
is_isogram(word),
(word, False),
msg="Non isogram word, '{}' falsely detected".format(word)
)
def test_it_only_accepts_strings(self):
with self.assertRaises(TypeError) as context:
is_isogram(2)
self.assertEqual(
'Argument should be a string',
context.exception.message,
'String inputs allowed only'
)
def test_empty_string_input(self):
word = " "
self.assertEqual(
is_isogram(word),
(word, False),
msg='Empty string not a avalid isogram'
)
Val
def is_isogram()
Val
please what should be the function to give out a word that appear twice?
Lapanit ☃️
Use pastebin avoid spam
Anonymous
Yeah
Val
https://pastebin.com/fePniS59
Abhi
i am writing test code to check if a url is working fine
Abhi
def test_post_list(self):
response = self.client.get('posts/search/')
self.assertEqual(response.status_code, 200)
Abhi
i am getting error as it is giving "302 status code" error
Abhi
instead of 200
Anonymous
What is self. Client
Abhi
when i hitting the same url in Postman, it is giving "200 status code", what might be the error
inchidi
Abhi
it should just check if that url is working right ?
Anonymous
I don't know about unit testing
Val
https://pastebin.com/e1rMxA14
inchidi
inchidi
#starterpack
Group Butler
New to Django? here is some resource to start
Official docs tutorial
Step by step tutorial
Video tutorial
Another video tutorial
Books
Django by Example
Tango With Django
inchidi
welcome
Agus
thank you
Django Bot
>> Blogs
- Install Django on Linux Ubuntu
Anonymous
inchidi
true 😂
Abhi
inchidi
Abhi
Abhi
It is not
Anonymous
guys
Anonymous
I am using modelforms
Anonymous
and now I add two more fields in it
Anonymous
which aren't in model
Anonymous
what will happen
Anonymous
1. If I call .is_valid()
Anonymous
2. form.save()
Anonymous
ofc there are two more fields
Anonymous
I guess form will be valid
Anonymous
but what about saving in model
Abhi
anyone have used django-google-analytics ?
Abhi
but what about saving in model
just fetch the data from the submitted data in the form, and why make instance of your model then call instancename.create() function
Abhi
Abhi
ImportError: No module named 'django_google_analytics'
Charly
Charly
but reading the doc: https://github.com/clintecker/django-google-analytics
Charly
you can see that you need to import the module with the name 'google_analytics'
Abhi
@Carlangueitor where do i have to import it ?
Charly
Where are you importing it?
Abhi
i am not importing anywhere
Abhi
as soon a i installed the app and tried to run the server
Abhi
i am getting that error
Charly
how do you installed the app?
Lapanit ☃️
is mysql-connector available to install with brew
Lapanit ☃️
?
Abhi
@Carlangueitor i installed it using pip
Abhi
pip install django-google-analytics
Charly
and next?
Abhi
put that 'djagno_google_analytics' into insalled app
Charly
well, the error it's the same I already said, you are writing 'django_google_analytics´instead of 'google_analytics'
Abhi
@Carlangueitor I tried that too
Abhi
Still not working
Django Bot
>> Jobs
- Senior Django Developer
Manish
https://pastebin.com/7Hg0AGeu
Manish
(mydjango)~/mydjango/lib/python2.7/site-packages/django/db/backends $ls
base init.pyc postgresql_psycopg2 sqlite3 utils.py
dummy mysql signals.py util.py utils.pyc
init.py oracle signals.pyc util.pyc
(mydjango)~/mydjango/lib/python2.7/site-packages/django/db/backends $
Manish
>> import sqlite3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/deadzone/python27/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
from dbapi2 import *
File "/home/deadzone/python27/lib/python2.7/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: No module named _sqlite3
Manish
https://pastebin.com/hCfjuhu3
Group Butler
Rudra kicked for flood!
Davo
Haha
Manish
Anyone seen those error
Manish
Nd thnxx for unbanning me