Giter VIP home page Giter VIP logo

sani's People

Contributors

codemaestro1000 avatar derhnyel avatar hailelagi avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

chuboyo

sani's Issues

Write Tests ๐Ÿ˜ช

Write Tests for the following services

  • Debugger
  • Parsers
  • Script
  • Handler

Will keep updating ... we can use this to keep track of the tests generally

Fix mode doesn't write to file when some exceptions are raised

Here's the code you can use to reproduce the bug:

from sani.debugger import debugger
import json, zlib, datetime
from typing import Any, Dict

debug = debugger.Debugger(__name__, stdout="test.txt", channel="io")
debug.breakpoint(mode="fix", subject="cache operations")

def write_to_cache(query: str, result: Any, cache_obj: Dict):
    hash = zlib.adler32(query.encode('utf-8'))
    cache_obj[hash] = json.dumps(result)
    # redis_connection.set(hash, json.dumps(result))

objects = [
    {'id': '12341228', 'title': 'Hello world in python', 'view_count': 2378},
    {'id': '44780514', 'title': 'FastAPI with Odmantic', 'view_count': 1970},
    {'id': datetime.date(7123, 11, 28), 'title': 'pandas loc vs iloc', 'view_count': 4012},
    {'id': '02139172', 'title': 'Dataframe in Pandas', 'view_count': 4012}
]
cache = {}
query = 'pandas'
write_to_cache(query, objects[2], cache) # buggy call here.
print(cache)
debug.debugger_end_breakpoint()

Output:

    write_to_cache(query, objects[2], cache)
  File "/workspaces/sani/test_fix.py", line 10, in write_to_cache
    cache_obj[hash] = json.dumps(result)
  File "/usr/local/python/3.10.4/lib/python3.10/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/local/python/3.10.4/lib/python3.10/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/local/python/3.10.4/lib/python3.10/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/local/python/3.10.4/lib/python3.10/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '

2023-05-14 00:13:20,018::DEBUG::sani.debugger.debugger::Code Failed. No at exit mode was dispatched

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.