-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Copyright (c) 2012 Lars Hupfeldt Nielsen, Hupfeldt IT | ||
# All rights reserved. This work is under a BSD license, see LICENSE.TXT. | ||
|
||
from __future__ import print_function | ||
|
||
from multiconf import caller_file_line | ||
|
||
from .utils.utils import next_line_num | ||
|
||
from .utils_test_helpers import bb, fn_aa_exp, ln_aa_exp | ||
|
||
|
||
ln_bb_exp = None | ||
|
||
|
||
def test_caller_file_line(): | ||
def cc(): | ||
global ln_bb_exp | ||
|
||
fnc, lnc = caller_file_line(2) | ||
print("fnc, lnc:", fnc, lnc) | ||
|
||
ln_bb_exp = next_line_num() | ||
fnb, lnb, fna, lna = bb() | ||
|
||
return fnc, lnc, fnb, lnb, fna, lna | ||
|
||
fn_exp = __file__ | ||
ln_cc_exp = next_line_num() | ||
fnc, lnc, fnb, lnb, fna, lna = cc() | ||
|
||
assert fn_exp == fnc | ||
assert ln_cc_exp == lnc | ||
|
||
assert fn_exp == fnb | ||
assert ln_bb_exp == lnb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright (c) 2012 Lars Hupfeldt Nielsen, Hupfeldt IT | ||
# All rights reserved. This work is under a BSD license, see LICENSE.TXT. | ||
|
||
from __future__ import print_function | ||
|
||
from multiconf import caller_file_line | ||
|
||
from .utils.utils import next_line_num | ||
|
||
|
||
fn_aa_exp = __file__ | ||
ln_aa_exp = None | ||
|
||
|
||
def aa(): | ||
fna, lna = caller_file_line() | ||
print("fna, lna:", fna, lna) | ||
|
||
return fna, lna | ||
|
||
|
||
def bb(): | ||
global ln_aa_exp | ||
|
||
fnb, lnb = caller_file_line() | ||
print("fnb, lnb:", fnb, lnb) | ||
|
||
ln_aa_exp = next_line_num() | ||
fna, lna = aa() | ||
|
||
return fnb, lnb, fna, lna |