# Path: tibanna/top.py
# class Top(object):
# class Process(object):             
#     def __init__(self, contents):
#     def parse_contents(self, contents):
#     def digest(self, max_n_commands=16, sort_by='alphabetical'):
#     def get_collapsed_commands(self, max_n_commands):
#     def write_to_csv(self, csv_file, metric='cpu', delimiter=',', colname_for_timestamps='timepoints',
#                      timestamp_start=None, timestamp_end=None, base=0):
#     def should_skip_process(self, process):
#     def convert_command_to_collapsed_command(cmd, collapsed_commands):
#     def total_cpu_per_command(self, command):
#     def total_mem_per_command(self, command):
#     def sort_commands(self, by='cpu'):
#     def as_minutes(cls, timestamp, timestamp_start):
#     def timestamps_as_minutes(self, timestamp_start):
#     def as_datetime(cls, timestamp):
#     def wrap_in_double_quotes(string):
#     def first_words(string, n_words):
#     def first_characters(string, n_letters):
#     def as_dict(self):
#     def __init__(self, top_line):
#     def as_dict(self):


import os
from tibanna import top

top_contents = """

Timestamp: 2020-12-18-18:55:37
top - 18:55:37 up 4 days,  3:18,  2 users,  load average: 2.00, 2.00, 2.30
Tasks: 344 total,   1 running, 343 sleeping,   0 stopped,   0 zombie
%Cpu(s):  6.6 us,  0.1 sy,  0.0 ni, 93.2 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem : 12971188+total, 95469344 free, 28933200 used,  5309352 buff/cache
KiB Swap:        0 total,        0 free,        0 used. 10002531+avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
16962 root      20   0 36.456g 0.011t  19372 S  93.8  8.9 125:11.21 java -jar somejar.jar
17086 root      20   0 36.464g 0.016t  19572 S  70.0 13.0 178:59.28 bwa mem
17919 ubuntu    20   0   40676   3828   3144 R   6.2  0.0   0:00.01 top -b -n1 -c -i -w 10000


Timestamp: 2020-12-18-18:56:37
top - 18:56:37 up 4 days,  3:18,  2 users,  load average: 2.00, 2.00, 2.30
Tasks: 344 total,   1 running, 343 sleeping,   0 stopped,   0 zombie
%Cpu(s):  6.6 us,  0.1 sy,  0.0 ni, 93.2 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem : 12971188+total, 95469344 free, 28933200 used,  5309352 buff/cache
KiB Swap:        0 total,        0 free,        0 used. 10002531+avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
16962 root      20   0 36.456g 0.011t  19372 S  92.8  9.9 125:11.21 java -jar somejar.jar
17919 ubuntu    20   0   40676   3828   3144 R   5.2  0.0   0:00.01 top -b -n1 -c -i -w 10000
"""


def test_empty_top():

# Path: tibanna/top.py
# class Top(object):
# class Process(object):             
#     def __init__(self, contents):
#     def parse_contents(self, contents):
#     def digest(self, max_n_commands=16, sort_by='alphabetical'):
#     def get_collapsed_commands(self, max_n_commands):
#     def write_to_csv(self, csv_file, metric='cpu', delimiter=',', colname_for_timestamps='timepoints',
#                      timestamp_start=None, timestamp_end=None, base=0):
#     def should_skip_process(self, process):
#     def convert_command_to_collapsed_command(cmd, collapsed_commands):
#     def total_cpu_per_command(self, command):
#     def total_mem_per_command(self, command):
#     def sort_commands(self, by='cpu'):
#     def as_minutes(cls, timestamp, timestamp_start):
#     def timestamps_as_minutes(self, timestamp_start):
#     def as_datetime(cls, timestamp):
#     def wrap_in_double_quotes(string):
#     def first_words(string, n_words):
#     def first_characters(string, n_letters):
#     def as_dict(self):
#     def __init__(self, top_line):
#     def as_dict(self):


# Path: tests/tibanna/unicorn/test_top.py
import os
from tibanna import top


top_contents = """

Timestamp: 2020-12-18-18:55:37
top - 18:55:37 up 4 days,  3:18,  2 users,  load average: 2.00, 2.00, 2.30
Tasks: 344 total,   1 running, 343 sleeping,   0 stopped,   0 zombie
%Cpu(s):  6.6 us,  0.1 sy,  0.0 ni, 93.2 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem : 12971188+total, 95469344 free, 28933200 used,  5309352 buff/cache
KiB Swap:        0 total,        0 free,        0 used. 10002531+avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
16962 root      20   0 36.456g 0.011t  19372 S  93.8  8.9 125:11.21 java -jar somejar.jar
17086 root      20   0 36.464g 0.016t  19572 S  70.0 13.0 178:59.28 bwa mem
17919 ubuntu    20   0   40676   3828   3144 R   6.2  0.0   0:00.01 top -b -n1 -c -i -w 10000


Timestamp: 2020-12-18-18:56:37
top - 18:56:37 up 4 days,  3:18,  2 users,  load average: 2.00, 2.00, 2.30
Tasks: 344 total,   1 running, 343 sleeping,   0 stopped,   0 zombie
%Cpu(s):  6.6 us,  0.1 sy,  0.0 ni, 93.2 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem : 12971188+total, 95469344 free, 28933200 used,  5309352 buff/cache
KiB Swap:        0 total,        0 free,        0 used. 10002531+avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
16962 root      20   0 36.456g 0.011t  19372 S  92.8  9.9 125:11.21 java -jar somejar.jar
17919 ubuntu    20   0   40676   3828   3144 R   5.2  0.0   0:00.01 top -b -n1 -c -i -w 10000
"""


def test_empty_top():

    top1 = top.Top('')