Esempio n. 1
0
def test_name(name, expected):
  if prepare_file(name):
    translation_name = repyhelper.translate(name)
    
    if translation_name != expected:
      print "ERROR: expected:", expected, " but translation name was:", translation_name
      
    test_utils.cleanup_file(name)
    test_utils.cleanup_file(translation_name + ".py")
  else:
    print "Couldn't prepare test for filename test:", name
Esempio n. 2
0
def test_name(name, expected):
  if prepare_file(name):
    translation_name = repyhelper.translate(name)
    
    if translation_name != expected:
      print "ERROR: expected:", expected, " but translation name was:", translation_name
      
    test_utils.cleanup_file(name)
    test_utils.cleanup_file(translation_name + ".py")
  else:
    print "Couldn't prepare test for filename test:", name
Esempio n. 3
0
  fh = open(filename, 'w')
  print >> fh, contents
  fh.close()
  return filename
  
  
create_testfile(TESTFILE, repyhelper.TRANSLATION_TAGLINE)

### Test Nonexistant Files ###

if repyhelper._translation_is_needed(SRCFILE, "file_doesnt_exist'"):
  pass
else:
  print "Test failed for translation path that doesn't exist'"

test_utils.cleanup_file(TESTFILE_TR)

#Test source (repy) file
try: 
  repyhelper._translation_is_needed("random_file246565324", TESTFILE)
except repyhelper.TranslationError:
  pass
else:
  print "Didnt raise exception when provided nonexistant souce file"

test_utils.cleanup_file(TESTFILE_TR)

create_testfile(TESTFILE, repyhelper.TRANSLATION_TAGLINE)

#Test directory...
try: 
Esempio n. 4
0
  fh = open(filename, 'w')
  print >> fh, contents
  fh.close()
  return filename
  
  
create_testfile(TESTFILE, repyhelper.TRANSLATION_TAGLINE)

### Test Nonexistant Files ###

if repyhelper._translation_is_needed(SRCFILE, "file_doesnt_exist'"):
  pass
else:
  print "Test failed for translation path that doesn't exist'"

test_utils.cleanup_file(TESTFILE_TR)

#Test source (repy) file
try: 
  repyhelper._translation_is_needed("random_file246565324", TESTFILE)
except repyhelper.TranslationError:
  pass
else:
  print "Didnt raise exception when provided nonexistant souce file"

test_utils.cleanup_file(TESTFILE_TR)

create_testfile(TESTFILE, repyhelper.TRANSLATION_TAGLINE)

#Test directory...
try: