Re: How can i distribute amounts between several accounts based on set % or ratio?

2018-11-29 Thread Justus Pendleton
On Friday, November 30, 2018 at 7:27:11 AM UTC+7, mpl...@gmail.com wrote:
>
> Let say i have transactions going into account Expenses:Rent, and i would 
> like 60% of total go to Expenses:Rent:Personal and 40% to 
> Expenses:Rent:Business,
> what's the best way to do it?
>

I think the best way is to just be explicit and write: $600 to one and $400 
to the other. 

If you really want to though, beancount supports simple math expressions so 
you can write:

Expenses:Rent:Personal (1,000 * 0.6) USD
Expenses:Rent:Business (1,000 * 0.4) USD


-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beancount+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/6b3aedf9-1da8-4983-94f1-4cb3b502f7f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How can i distribute amounts between several accounts based on set % or ratio?

2018-11-29 Thread mployby
Guys hi,

Let say i have transactions going into account Expenses:Rent, and i would 
like 60% of total go to Expenses:Rent:Personal and 40% to 
Expenses:Rent:Business,
what's the best way to do it?

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beancount+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/db8ba07f-cb96-47b4-99ae-dabd6020fa1e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Nose tests for ingest - do they work OOTB?

2018-11-29 Thread Oon-Ee Ng
On Thu, Nov 29, 2018 at 10:15 PM Martin Blais  wrote:

> On Thu, Nov 29, 2018 at 4:05 AM Oon-Ee Ng  wrote:
>
>> Thanks, that worked. I've run into a simple problem which may or may not
>> be a bug.
>>
>> If there's non python files in the same directory, they're passed to the
>> test, but not filtered by identify(). This means if I'm writing a pdf test,
>> for example, and have a txt file in the same directory, the tests always
>> fail.
>>
>
> Quick question (not disingenuous): do you really need that txt file? Can
> you do without?
>

Yes, I can. I was just surprised with that behaviour because it does not
match (in my mind) what was being tested, which was the entirety of the
bean-extract logic (including identify).

It may be more correct to run identify() and not run
>> extract/file_name/file_date/file_account if that fails. That may be out of
>> scope though.
>>
>
> It's been a while, but I cleaned up all my importer code at the same time
> I ported to pytest, and IIRC I changed it so that it was unconditional. It
> seemed more predictable that way.
> I can have a look.
> Best is if you can send an example directory that fails for you.
>

Fair enough, while it's always possible to imagine cases where someone
might want to regression-test identify, I'd agree that it's probably not
worth any maintenance work.

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beancount+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAGQ70es_aSPqHB%3D7Tw-niAUda4Zj0ht1XRF74BiUkDg5YLTHyA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sorting of bean-extract output

2018-11-29 Thread Zhuoyun Wei
2018-11-29 14:14:44 Oon-Ee Ng :
> On Thu, Nov 29, 2018 at 2:06 PM Daniele Nicolodi  wrote:
> 
> On 28/11/2018 20:53, Martin Blais wrote:
> >     The current source file for importing that I'm working on lists
> >     transaction in reverse chronological order (I want chronological, in
> >     this case) but also has a reference number that is monotonically
> >     increasing. So my current hack is to set line number for the
> >     transactions to be that reference number.
> >
> >
> > That seems not unlike the idea of storing the time in metadata -
> > discussed in a prior thread but not yet implemented - and to use that as
> > a secondary sort key. Maybe I can generalize this idea of a secondary
> > sort key to let users put whatever they want in there (as long as the
> > type is comparable, for sorting).
> 
> Aren't directives written in the order in which they are returned by the
> importer?  I didn't see any mention of the fact that bean-extract does
> any sorting on its own in the documentation, but I may have missed it.
> 
> Cheers,
> Dan
> 
> 
> That was my impression as well, but after testing it out I found this was not 
> the case. The returned ordered list of
> transactions is then sorted by date and line number. 
> 

I was once troubled by this sorting behaviour as well. Intra-day
transactions are sorted reverse-chronologically (newer to older) in the
CSV file exported from my bank. My importer parses the entries in
reversed order, returning a correctly ordered list of transactions
(older to newer). However, Beancount will again sort the list returned
by importer, shuffling the intra-day transactions:

https://github.com/beancount/beancount/blob/fb2d29eed89a8e15f1635847beba0e5598c0ea06/beancount/ingest/extract.py#L73-L74

I had once submitted a pull request to disable this behaviour, it was
merged but later reverted by Martin.

So I came up with a workaround:

```
# Re-generate "lineno" to force sorting
for lineno, entry in enumerate(entries, start=1):
entry.meta['lineno'] = lineno
```

Just generate artificial "lineno" keys and insert them into the
transactions before returning them to Beancount. This way I can preserve
the order.

A possible approach to make both parties happy would be to add a new
parameter to "extract_from_file()" function, allowing importers to
disable the sorting behaviour in post-processings.


> --
> You received this message because you are subscribed to the Google Groups 
> "Beancount" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to
> beancount+unsubscr...@googlegroups.com.
> To post to this group, send email to beancount@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/beancount/
> CAGQ70esZ%2BSFkn4VcaG1dh%2BP1i%3DNgQ9rHvSdx-_8eVKvJ1%3DcRMg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
Zhuoyun Wei

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beancount+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/20181129151330.GA28669%40tarball.wzyboy.org.
For more options, visit https://groups.google.com/d/optout.


signature.asc
Description: PGP signature


Re: Questions about price sources

2018-11-29 Thread 'Patrick Ruckstuhl' via Beancount



On November 29, 2018 3:13:13 PM GMT+01:00, Martin Blais  wrote:
>On Thu, Nov 29, 2018 at 9:06 AM Justus Pendleton 
>wrote:
>
>> On Thursday, November 29, 2018 at 6:49:30 PM UTC+7, Patrick Ruckstuhl
>> wrote:
>>>
>>> Not really I'm accessing different markets which have different
>times and
>>> some don't have a price every day, so the price date might be a
>previous
>>> day.
>>>
>>
>> Sure, I do that, too. I'm still not seeing the problem. Run
>bean-price and
>> use the price at that time. Why does it matter if you store an
>intraday
>> price? What do you think happens when you buy or sell something in
>> beancount? The intraday price gets added to the price map. I don't
>think
>> beancount is really meant for use cases where the difference between
>the
>> price at 3pm and 4:30pm is material.
>>
>
>That's correct.
>(Well, the correct price will be attached to the Posting object, but
>for
>computing market value, there's one price/day.)
>
>
>Anyway, it is really bothers you to have intraday prices then wait a
>day,
>> or a week, and then use bean-price to get the prices from 2 or 3 days
>using
>> the -d parameter once everything is closed & finalized.
>>
>
>For intra-day values you can upload your portfolio contents to a google
>sheets doc and feed live prices.
>That's what I do.
>My code for it is located here (it's a little bit custom, you may need
>to
>add similar metadata fields):
>https://bitbucket.org/blais/beancount/src/tip/beancount/projects/export.py
>
>
>>
>> Or run bean-price twice a day (or four times a day) and only fetch
>prices
>> for markets that are closed when you run it.
>>
>> I'm honestly kind of struggling to understand what explicit support
>you're
>> looking for from bean-price here. Can you elaborate on that a bit?
>What's
>> the exact usage you envision from beancount?
>>
>
>I'm also a little bit confused.
>

Let my try to explain what I'm trying to do, 
maybe I'm looking at things wrongly.
I would like to have a local price database. I do this with beancount files 
with price directives. What I'm now looking at is how to update this price 
files. They basically contain one entry per day and are updated daily. But on a 
daily run it can return a price date which already exists and I'm looking at a 
way to update (or maybe ignore) that entry.

I would also like all the price directives be in my base ccy as this then 
allows me simple reports as I know that I have prices to base ccy for 
everything. Here the problem is that some price sources will return the price 
in another ccy and I have to first convert it into my base ccy before creating 
the price entry.

I can create a script which does all that thing, I wad just wondering if there 
is a better/easier way than to create my own script.

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beancount+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/47B71B9B-C082-41A7-AB6B-67E40504D6C5%40ch.tario.org.
For more options, visit https://groups.google.com/d/optout.


Re: Sorting of bean-extract output

2018-11-29 Thread Daniele Nicolodi
Hello Maetin,

On 29/11/2018 07:08, Martin Blais wrote:
> Let me get this right: you're proposing a patch that affects the parser
> layer, that has potential to break a bunch other people's stuff, and
> you're not bothering to write a test that specifically handles that case?
> This is a perfect example how not to contribute to a released open
> source project.
> I have no time for "largely untested" patches.

I think I didn't explain well enough what my idea is (however, if you
would have looked at the patch I believe you could have understood it
rather quickly).

The problem I tried to solve is that in the ingestion process, before
being serialized into a beancount file, entries are sorted by date,
type, and origin file line number. It has ben requested if the sorting
order could take into account transaction time.

The solution I proposed is to allow the ingestion machinery to accept a
datetime object for the date field. The time would be thrown out in the
serialization, but would be used for sorting. It is similar to using
time information stored in the meta field.

The implementation is simple as the only thing that needs to change is
the serialization in minimal part. After looking at the code the only
thing that needs to be done is to replace the string formatting for date
entries from ...format('{e,date} ...', e) to
...format('{e.date:%Y-%m-%d}...', e). There is no change to the parser
layer.

The patch does not come with tests because I thought to it as a better
description of the kind of solution I'm proposing, rather than something
ready to be merges.

I interpret your answer as very hostile (please correct me if this
impression is wrong). Thus I am happy that I haven't invested more time
in my attempt to contribute an idea to your project.

Best,
Dan

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beancount+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/f9097208-7347-1532-fcdb-5986dce3518e%40grinta.net.
For more options, visit https://groups.google.com/d/optout.


Re: Nose tests for ingest - do they work OOTB?

2018-11-29 Thread Martin Blais
On Thu, Nov 29, 2018 at 4:05 AM Oon-Ee Ng  wrote:

> Thanks, that worked. I've run into a simple problem which may or may not
> be a bug.
>
> If there's non python files in the same directory, they're passed to the
> test, but not filtered by identify(). This means if I'm writing a pdf test,
> for example, and have a txt file in the same directory, the tests always
> fail.
>

Quick question (not disingenuous): do you really need that txt file? Can
you do without?


>
> It may be more correct to run identify() and not run
> extract/file_name/file_date/file_account if that fails. That may be out of
> scope though.
>

It's been a while, but I cleaned up all my importer code at the same time I
ported to pytest, and IIRC I changed it so that it was unconditional. It
seemed more predictable that way.
I can have a look.
Best is if you can send an example directory that fails for you.




>
> On Thu, Nov 29, 2018 at 2:18 PM Martin Blais  wrote:
>
>> Just about to leave, but very quickly, nose support is deprecated.
>> Switch to pytest.
>>
>>
>> On Thu, Nov 29, 2018 at 12:56 AM Oon-Ee Ng 
>> wrote:
>>
>>> I've modified the utrade example in
>>> https://bitbucket.org/blais/beancount/src/4c79f94e0858/examples/ingest/office/importers/utrade/?at=default
>>>
>>> Basically I'm using the structure recommended in 'Importing external
>>> data', so I have:-
>>> mainfolder -> importers -> tng -> *everything here*
>>>
>>> tng is the name of this particular importer, of course. I have an empty
>>> __init__.py, a tng.py with my implementation (analogous to utrade_csv.py,
>>> also copies the test() function from there), and a tng_test.py (copy pasted
>>> with slight modifications from utrade_csv_test.py)
>>>
>>> When in mainfolder, I run:- nosetests -s -v importers
>>>
>>> And I get something I can't really debug, as text_extract isn't
>>> functions I wrote, think it's autogenerated:-
>>> ==
>>> ERROR: Extract entries from a test file and compare against expected
>>> output.
>>> --
>>> Traceback (most recent call last):
>>>   File
>>> "/home/me/Files/Code/venvs/fava/lib/python3.7/site-packages/nose/case.py",
>>> line 198, in runTest
>>>
>>> self.test(*self.arg)
>>> TypeError: test_extract() missing 3 required positional arguments:
>>> 'importer', 'file', and 'pytestconfig'
>>>
>>> ==
>>>
>>> Is there something I'm missing?
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Beancount" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to beancount+unsubscr...@googlegroups.com.
>>> To post to this group, send email to beancount@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/beancount/CAGQ70eukraPT2iYJx435Vj-Uk3b_59MXarjUGaAB4Jmsnxgc_w%40mail.gmail.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Beancount" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to beancount+unsubscr...@googlegroups.com.
>> To post to this group, send email to beancount@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/beancount/CAK21%2BhN%2BVm8QPw4MouxFkYpeQdYRHsnndsQw9pa0QF%2BreZ1f4g%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Beancount" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to beancount+unsubscr...@googlegroups.com.
> To post to this group, send email to beancount@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/CAGQ70ev-5jgLc_TXnspYa8NtASmeN9DaszEkaza0X_g3Bq5Fpw%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beancount+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CA

Re: Questions about price sources

2018-11-29 Thread Martin Blais
On Thu, Nov 29, 2018 at 9:06 AM Justus Pendleton  wrote:

> On Thursday, November 29, 2018 at 6:49:30 PM UTC+7, Patrick Ruckstuhl
> wrote:
>>
>> Not really I'm accessing different markets which have different times and
>> some don't have a price every day, so the price date might be a previous
>> day.
>>
>
> Sure, I do that, too. I'm still not seeing the problem. Run bean-price and
> use the price at that time. Why does it matter if you store an intraday
> price? What do you think happens when you buy or sell something in
> beancount? The intraday price gets added to the price map. I don't think
> beancount is really meant for use cases where the difference between the
> price at 3pm and 4:30pm is material.
>

That's correct.
(Well, the correct price will be attached to the Posting object, but for
computing market value, there's one price/day.)


Anyway, it is really bothers you to have intraday prices then wait a day,
> or a week, and then use bean-price to get the prices from 2 or 3 days using
> the -d parameter once everything is closed & finalized.
>

For intra-day values you can upload your portfolio contents to a google
sheets doc and feed live prices.
That's what I do.
My code for it is located here (it's a little bit custom, you may need to
add similar metadata fields):
https://bitbucket.org/blais/beancount/src/tip/beancount/projects/export.py


>
> Or run bean-price twice a day (or four times a day) and only fetch prices
> for markets that are closed when you run it.
>
> I'm honestly kind of struggling to understand what explicit support you're
> looking for from bean-price here. Can you elaborate on that a bit? What's
> the exact usage you envision from beancount?
>

I'm also a little bit confused.


>

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beancount+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhPP_6Z0MX-Su3-%3DdHBR4REU-WUgd6PLmmxN-wTrE26E6g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sorting of bean-extract output

2018-11-29 Thread Martin Blais
On Thu, Nov 29, 2018 at 2:17 AM Daniele Nicolodi  wrote:

> On 28/11/2018 23:22, Daniele Nicolodi wrote:
> > On 28/11/2018 23:17, Martin Blais wrote:
> >> On Thu, Nov 29, 2018 at 1:14 AM Oon-Ee Ng  >>
> >> That was my impression as well, but after testing it out I found
> >> this was not the case. The returned ordered list of transactions is
> >> then sorted by date and line number.
> >>
> >>
> >> Yes. Sorted by date.
> >
> > Is that documented?
>

https://docs.google.com/document/d/1wAMVrKIA2qtRGmoVDSUBJGmYZSygUaR0uOMW1GV3YE0/edit#heading=h.gni5f2cin8rd
https://bitbucket.org/blais/beancount/src/4c79f94e085880bb1d4b469c931435eb246855bf/beancount/core/data.py#lines-568

>
> > Would it be a possibility to accept a datetime object instead that a
> > date object for the date field (and do not serialize the time part into
> > the written file) be enough to obtain sorting by date and time?
>

No.
We've discussed this at length before.
This opens a can of worms, will you support all the things that will break
on adding a new constraint?



> >
> > Actually, datetime objects are already accepted building metadata
> > instances and I guess the sorting does not strip the time away, thus
> > only the serialization would need to be changed. I guess I can prepare a
> > patch for this.
>
> The patch is easy enough and attached, although it is largely untested.
>

Let me get this right: you're proposing a patch that affects the parser
layer, that has potential to break a bunch other people's stuff, and you're
not bothering to write a test that specifically handles that case?
This is a perfect example how not to contribute to a released open source
project.
I have no time for "largely untested" patches.

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beancount+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAK21%2BhMXVpAY%2Bg%2BzPCCU%3DaZ6wFSdz%2B%3DFMAOxbJEP7fi4JUp8GA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Questions about price sources

2018-11-29 Thread Justus Pendleton
On Thursday, November 29, 2018 at 6:49:30 PM UTC+7, Patrick Ruckstuhl wrote:
>
> Not really I'm accessing different markets which have different times and 
> some don't have a price every day, so the price date might be a previous 
> day. 
>

Sure, I do that, too. I'm still not seeing the problem. Run bean-price and 
use the price at that time. Why does it matter if you store an intraday 
price? What do you think happens when you buy or sell something in 
beancount? The intraday price gets added to the price map. I don't think 
beancount is really meant for use cases where the difference between the 
price at 3pm and 4:30pm is material.

Anyway, it is really bothers you to have intraday prices then wait a day, 
or a week, and then use bean-price to get the prices from 2 or 3 days using 
the -d parameter once everything is closed & finalized.

Or run bean-price twice a day (or four times a day) and only fetch prices 
for markets that are closed when you run it.

I'm honestly kind of struggling to understand what explicit support you're 
looking for from bean-price here. Can you elaborate on that a bit? What's 
the exact usage you envision from beancount?

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beancount+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/e83283db-fab3-4cc5-a591-16c32b04b2d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Questions about price sources

2018-11-29 Thread 'Patrick Ruckstuhl' via Beancount



On November 29, 2018 4:54:21 AM GMT+01:00, Justus Pendleton 
 wrote:
>On Wednesday, November 28, 2018 at 5:43:07 AM UTC+7, Patrick Ruckstuhl 
>wrote: 
>
>> 3) I'm planing to fetch prices on a daily basis and write them out as
>
>> price directives so that if a price source disappears I still have
>all the 
>> previously fetched prices, does that make sense? Any easy way to do
>this 
>> with bean-price? Especially with updated intraday prices where I
>can't 
>> simply append the output of bean-price 
>>
>Yes, it is easy. Simply append the output of bean-price. Don't run 
>bean-price when markets are open :). Problem solved: no intraday prices
>
>used. I use the power of computers to run bean-price at 3am.

Not really I'm accessing different markets which have different times and some 
don't have a price every day, so the price date might be a previous day.

>
>Anyway, there's nothing wrong with just using intraday prices, too. 
>Intraday prices aren't "wrong" and closing prices aren't "right". The 
>closing price is just the intraday price at 4:30.
>
>1) I specify the price ccy twice, on the one hand in the lookup
>expression 
>> and on the other hand the Source needs to also fill this in when
>creating 
>> the SourcePrice. As far as I can tell only the one from the lookup is
>used, 
>> which makes sense for me as often the source will not know the price
>ccy. 
>> Should this get dropped from SourcePrice? 
>>
>
>Dunno. Since the currency is required ("Supported format is 
>CCY:module/SYMBOL") I see what you're saying. I'm not sure if there's
>some 
>other entry point to SourcePrice or not.
> 
>
>> 2) I would like to convert all my prices into a base ccy. Is there
>any 
>> infrastructure around for something like this? I'm not talking about 
>> transitive prices, all I would need is to be able to convert a price
>into 
>> my base ccy based on an other conversion. What I'm thinking is
>something 
>> like 
>> * fetch price from Source in USD 
>> * using existing price data convert USD price into CHF
>>
>
>I'm not sure I understand what you're trying to do. Where do you want
>to 
>see this CHF? In bean-web or...? Don't you just set your
>operating_currency 
>to CHF? Anyway, it *does* sound like you're talking about transitive 
>prices. How is this different from transitive prices?

I'm looking at normalizing my "stored" prices instead of converting transitive 
afterwards which should be simpler.

Right now I'm creating my price db from an external system and just create a 
file with price statements and I'm now looking to get rid off that system and 
reuse as much existing functionality as possible.

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beancount+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/A1CEDB61-6EA9-4709-82F8-ADC1342075EE%40ch.tario.org.
For more options, visit https://groups.google.com/d/optout.


Re: Nose tests for ingest - do they work OOTB?

2018-11-29 Thread Oon-Ee Ng
Thanks, that worked. I've run into a simple problem which may or may not be
a bug.

If there's non python files in the same directory, they're passed to the
test, but not filtered by identify(). This means if I'm writing a pdf test,
for example, and have a txt file in the same directory, the tests always
fail.

It may be more correct to run identify() and not run
extract/file_name/file_date/file_account if that fails. That may be out of
scope though.

On Thu, Nov 29, 2018 at 2:18 PM Martin Blais  wrote:

> Just about to leave, but very quickly, nose support is deprecated.
> Switch to pytest.
>
>
> On Thu, Nov 29, 2018 at 12:56 AM Oon-Ee Ng  wrote:
>
>> I've modified the utrade example in
>> https://bitbucket.org/blais/beancount/src/4c79f94e0858/examples/ingest/office/importers/utrade/?at=default
>>
>> Basically I'm using the structure recommended in 'Importing external
>> data', so I have:-
>> mainfolder -> importers -> tng -> *everything here*
>>
>> tng is the name of this particular importer, of course. I have an empty
>> __init__.py, a tng.py with my implementation (analogous to utrade_csv.py,
>> also copies the test() function from there), and a tng_test.py (copy pasted
>> with slight modifications from utrade_csv_test.py)
>>
>> When in mainfolder, I run:- nosetests -s -v importers
>>
>> And I get something I can't really debug, as text_extract isn't functions
>> I wrote, think it's autogenerated:-
>> ==
>> ERROR: Extract entries from a test file and compare against expected
>> output.
>> --
>> Traceback (most recent call last):
>>   File
>> "/home/me/Files/Code/venvs/fava/lib/python3.7/site-packages/nose/case.py",
>> line 198, in runTest
>>
>> self.test(*self.arg)
>> TypeError: test_extract() missing 3 required positional arguments:
>> 'importer', 'file', and 'pytestconfig'
>>
>> ==
>>
>> Is there something I'm missing?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Beancount" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to beancount+unsubscr...@googlegroups.com.
>> To post to this group, send email to beancount@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/beancount/CAGQ70eukraPT2iYJx435Vj-Uk3b_59MXarjUGaAB4Jmsnxgc_w%40mail.gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Beancount" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to beancount+unsubscr...@googlegroups.com.
> To post to this group, send email to beancount@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/beancount/CAK21%2BhN%2BVm8QPw4MouxFkYpeQdYRHsnndsQw9pa0QF%2BreZ1f4g%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beancount+unsubscr...@googlegroups.com.
To post to this group, send email to beancount@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/CAGQ70ev-5jgLc_TXnspYa8NtASmeN9DaszEkaza0X_g3Bq5Fpw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.