Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8678223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:39:39+00:00 2026-06-12T20:39:39+00:00

This is my function: def get_value(request, param): s = get_string(request, param) value = re.search(‘(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)’,

  • 0

This is my function:

def get_value(request, param):
  s = get_string(request, param)
  value = re.search('(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)', s)
  if not value:
    print 'match not found!'  
    raise Exception('incorrect format: %s' % param)

test function:

def test_get_value(self):
    m = test_mocks.HttpRequestMock(REQUEST = {'start_date': '2011.07.31'})
    print '*************************'
    print 'date format changed'
    self.assertRaises(Exception, get_value, (m, 'start_date'))
    print '*********************

get_value doesn’t print: match not found!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T20:39:40+00:00Added an answer on June 12, 2026 at 8:39 pm

    It seems there is some issue with your python version. I guess you are using python below version 2.6.
    Try passing function parameters as other arguments to function i.e. do not put them inside tuple. Try this.

    self.assertRaises(Exception, helpers.get_value, m, 'start_date')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

consider this simple function def foo(l=[]): if not l: print List is empty else
I have a function friend_exists like this: def friend_exists(request, pid): result = False try:
This is my view function @csrf_request def view_function(request, template_name): c = {} return return
While running this function to validate captcha key and value i am not able
I'm trying to solve this newbie puzzle: I've created this function: def bucket_loop(htable, key):
I am writing a script and in my script I have this function: def
I'm using this simple function: def print_players(players): tot = 1 for p in players:
is there any way I can reproduce this ruby function: def Password.hash(password,salt) Digest::SHA512.hexdigest(#{password}:#{salt}) end
I have this function in Python: def Rotate_Vector(vector, axis, direction): where vector is a
For some reason this function confused me: def protocol(port): return port == 443 and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.