/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

Viewing changes to breezy/tests/test_lazy_import.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-24 01:39:33 UTC
  • mfrom: (3815.3776.6)
  • Revision ID: jelmer@jelmer.uk-20170524013933-ir4y4tqtrsiz2ka2
New upstream snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import re
22
22
import sys
23
23
 
24
 
from bzrlib import (
 
24
from .. import (
25
25
    errors,
26
26
    lazy_import,
27
27
    osutils,
28
28
    )
29
 
from bzrlib.tests import (
 
29
from . import (
30
30
    TestCase,
31
31
    TestCaseInTempDir,
32
32
    )
206
206
 
207
207
        final_globals = set(globals().keys())
208
208
 
209
 
        self.assertEqual(set(['test_scope1']), new_globals - orig_globals)
 
209
        self.assertEqual({'test_scope1'}, new_globals - orig_globals)
210
210
        self.assertEqual(set(), orig_globals - new_globals)
211
211
        self.assertEqual(set(), final_globals - new_globals)
212
212
        self.assertEqual(set(), new_globals - final_globals)
1053
1053
        self.assertRaises(errors.ImportNameCollision,
1054
1054
                          proc._build_map, 'from bar import foo')
1055
1055
 
 
1056
    def test_relative_imports(self):
 
1057
        proc = lazy_import.ImportProcessor()
 
1058
        self.assertRaises(ImportError,
 
1059
                          proc._build_map, 'import .bar as foo')
 
1060
        self.assertRaises(ImportError,
 
1061
                          proc._build_map, 'from .foo import bar as foo')
 
1062
        self.assertRaises(ImportError,
 
1063
                          proc._build_map, 'from .bar import foo')
 
1064
 
1056
1065
 
1057
1066
class TestLazyImportProcessor(ImportReplacerHelper):
1058
1067